Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    67

    Unanswered: Query Clarification

    I have a query like this
    ---------------------------------------------------------------------------
    SELECT

    A,B,C,D

    FROM TABLEA, TABLEB, TABLEC

    WHERE

    TABLEA.COLUMNA = 'R' and
    TABLEA.COLUMNB = 'A' and
    TABLEA.COLUMNC = 'C'

    ---------------------------------------------------------------------------

    In TABLEA, COLUMNA and COLUMNB are mandatory fields and will always have values.

    COLUMNC is optional

    I want a single query that will still return me all the rows that i want
    even if columnc is null.

    Can anyone modify the above query and let me know the same

    thanks
    Shankar

  2. #2
    Join Date
    Jan 2004
    Posts
    492
    I dont quite understand what you're asking so here's 2 answers

    If everything is in the same table do this:

    Select columnA, columnB, nvl(columnC, ' ' )
    from table a


    If the info is in different tables you'd have to do some sort of outer join

    Very hard to tell by your table descriptions , but here's an example.

    Table A --- (id, name)
    Table B --- (id, name)
    Table C --- (id, name)


    Select a.name, b.name, c.name
    from a,b,c
    where a.id = b.id
    and a.id = c.id (+)


    Tell me if this helps at all

  3. #3
    Join Date
    Jan 2004
    Posts
    67
    Originally posted by ss659
    I dont quite understand what you're asking so here's 2 answers

    If everything is in the same table do this:

    Select columnA, columnB, nvl(columnC, ' ' )
    from table a


    If the info is in different tables you'd have to do some sort of outer join

    Very hard to tell by your table descriptions , but here's an example.

    Table A --- (id, name)
    Table B --- (id, name)
    Table C --- (id, name)


    Select a.name, b.name, c.name
    from a,b,c
    where a.id = b.id
    and a.id = c.id (+)


    Tell me if this helps at all

    I got the answer ...
    thanks

Posting Permissions

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