Results 1 to 3 of 3

Thread: SQL Query Error

  1. #1
    Join Date
    Oct 2007
    Posts
    10

    SQL Query Error

    When I run this SQL query, I get the following error:

    injury_or_illness, cust from test where cust
    LIKE (
    select code from lookup where lookuparea='DEPARTMENTS' and data_id in (
    select data_id from lookup_email where receipient = 'Admin'
    and notification_type = 'Representative'))||'%';



    ORACLE-01427: single-row subquery returns more than one row.

    Is there a SQL equivalent that will achieve the above using the LIKE operator?

    Thanks!

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Wrong place, this is sql server forum.

  3. #3
    Join Date
    Oct 2007
    Posts
    1

    Red face Oracle Equivalant to Select Top 1 columnName, . . .

    In the WHERE clause use where RowNum = 1

    Select injury_or_illness, cust
    from test
    where cust LIKE (select code
    from lookup
    where lookuparea='DEPARTMENTS'
    and data_id in (select data_id
    from lookup_email
    where receipient = 'Admin'
    and notification_type = 'Representative'
    )
    AND ROWNUM = 1
    )||'%';

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •