Subquery challenge

polina

Registered User.
Local time
Today, 18:31
Joined
Aug 21, 2002
Messages
100
Hi,

I have been struggling with this long enough.
Here is what I need to do using ONE query

1) SELECT DISTINCT IIF([F1]=1,"Y","X") as NAME, Transit from Table1 where Transit=7753

the above depending on the transit number as a criteria will return either one or two records

NAME: TRANSIT:
Y 7753
X 7753

OR

NAME: TRANSIT:
Y 2

OR

NAME: TRANSIT:
X 3

THe second part of the query should look at how many records have been returned. If 2 - then it should select only record that does not have "Y" in the NAME, if the query returned 1 record, then that one record will be displayed no matter what it is.

I can't build a subquery. I figured how to solve this problem using two queries, but I need it to be done in one.

Please help.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom