Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2002
    Posts
    227

    Unanswered: query without records

    Hi,
    I run this query

    SELECT A.COD, A.FLAG, B.AREA, B.NUM_ID
    FROM TAB A, TAB1 B
    WHERE A.ID=B.ID
    AND ((FLAG=1 AND COD <> 'M') OR (FLAG=2 AND COD = 'N'))

    With this query I get:

    no row select ( there are rows with flag=1 and cod<>'M')

    but if I run this query:

    SELECT A.COD, A.FLAG, B.AREA, B.NUM_ID
    FROM TAB A, TAB1 B
    WHERE A.ID=B.ID
    AND (FLAG=1 AND OR (FLAG=2 AND COD = 'N'))

    I get rows


    What I wrong??

    Thanks
    Raf

  2. #2
    Join Date
    Sep 2003
    Location
    The Netherlands
    Posts
    311
    hi,

    i don't think the second query will show any rows, like u posted the query :

    SELECT A.COD, A.FLAG, B.AREA, B.NUM_ID
    FROM TAB A, TAB1 B
    WHERE A.ID=B.ID
    AND (FLAG=1 AND OR (FLAG=2 AND COD = 'N'))

    the last line says and or at the same time.
    So pls post the real queries.
    Edwin van Hattem
    OCP DBA / System analyst

  3. #3
    Join Date
    Jul 2002
    Posts
    227
    sorry,


    SELECT A.COD, A.FLAG, B.AREA, B.NUM_ID
    FROM TAB A, TAB1 B
    WHERE A.ID=B.ID
    AND (FLAG=1 OR (FLAG=2 AND COD = 'N'))

  4. #4
    Join Date
    Sep 2003
    Location
    The Netherlands
    Posts
    311
    hi,

    what does the result set show in query 2?

    greetz
    Edwin van Hattem
    OCP DBA / System analyst

  5. #5
    Join Date
    Jul 2003
    Posts
    2,296
    Looks like you have no FLAGs that do not have a COD of 'M'
    but ANYWAYS:

    Can't you post the real queries and not fake all the naming?

    Paste your queries into sql-plus and then cut-paste the queries and results.

    Thanks.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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