Hi, I have 2 tables:
tblStations StationID
Station
tblStationUser RecordID
UserName
Station
I'm trying to come up with a dataset that contains the
tblStations.Sta tion
EXCEPT for where that Station exists in tblStationUser where the
UserName = @varUserName.
I've tried this but get 0 rows (I should get about 40):
SELECT tblStations.Sta tion
FROM tblStations
WHERE NOT EXISTS
(SELECT tblStationUser. Station FROM tblStationUser WHERE
tblStationUser. UserName=@varUs erName)
ORDER BY Station
I tried the subquery separately which returns the correct number of
rows.
Any clues as to where I'm going wrong?
Thanks!
Kathy
tblStations StationID
Station
tblStationUser RecordID
UserName
Station
I'm trying to come up with a dataset that contains the
tblStations.Sta tion
EXCEPT for where that Station exists in tblStationUser where the
UserName = @varUserName.
I've tried this but get 0 rows (I should get about 40):
SELECT tblStations.Sta tion
FROM tblStations
WHERE NOT EXISTS
(SELECT tblStationUser. Station FROM tblStationUser WHERE
tblStationUser. UserName=@varUs erName)
ORDER BY Station
I tried the subquery separately which returns the correct number of
rows.
Any clues as to where I'm going wrong?
Thanks!
Kathy
Comment