Results 1 to 2 of 2
  1. #1
    Sripriya is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    2

    Help with a Query

    Hello Team,

    I have a set of 3 tables.
    Tables A, B, C

    Tables A and B are inner joined using an ID field and Tables B and C are left joined using another ID field.

    I need all those records from table B irrespective of whether data is there in Table C or not and the other condition is one of the values in table C has to match the value selected from a dropdown.

    Basically Query goes like this.

    SELECT B.<field1>, B.<field2>, B.<field3>, B.<field4>, B.<field5>, A.<field1>, A.<field2>, A.<field3>, iif(isnull(C.<fieldname>,"N") FROM (B INNER JOIN A ON A.<fieldname> = B.<fieldname) LEFT JOIN C ON B.ID = C.QuestId where C.ClientId=<Some value got at runtime>

    Now as long as I dont give the where condition, my output is fine.. When there are no records for the selected client, it gives me 0 rows.
    Whether there is record for this particular client or not my out put has to fetch all the rows from table B

    Thanking in advance.

    Regards,
    K. Sripriya

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Create a query based on table C that does the filtering for the clientID. Do you left join of B to that newly created query.

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums