>>I am trying to figure out how to use a subquery in the following example:
>>
>>Table1
>>PK_FLD, TASK_NO
>>
>>Table2
>>TASK_NO, FLDA, FLDB
>>
>>I want the resulting query to have as many records as there are in Table1 adding columns FLDA and FLDB from
>>Table2 according to the matching TASK_NO.
>>
>>My attempt at this query is as following
>>
>>Select Table1.PK_FLD, Table1.TASK_NO, T2.FLDA, T2.FLDB from Table1 where (select * from Table2 where
>>TASK_NO = Table1.TASK_NO) T2
>>
>>
>>But I get error of incorrect use of subquery. What am I missing? TIA.
>
>You need to use a simple JOIN here, not a subquery (unless you wanted just one record from the second table), e.g.
>
>select T1.*, T2.* from Table1 T1 INNER JOIN Table2 T2 on T1.Task_No = T2.Task_No
>
>Instead of select * use the actual field names.
Please see my reply to Borislav. I didn't mention in my initial message that I want the records from the Table2 that do not have matching to Table1 to be included in the resulting query as well.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham