This might be too simple of a question to post here. But anyway... I would appreciate if anyone could answer this:
I have two tables, Visitors and Registrants. The relationship between two tables is that every Registrant is a (web site) Visitor. The primary key of Visitor table (v_id) is foreign key in Registrant table, hence enforcing the 1-to-many relationship between tables. Registrant table has its own PK as reg_id. Essentially, Registrant table contains log of those visitors who in fact registered.
How can I retrieve the rows from Visitors table for users who did NOT register? In other words, just opposite of what I would getting if I JOIN the two tables. Any ideas?
Thanks,
W.
Something like this?
SELECT * FROM Visitors WHERE V_ID NOT IN (SELECT DISTINCT V_ID FROM Registrant)
|||Yes, thanks!
No comments:
Post a Comment