Tuesday, April 24, 2012

Select with Multiple clauses

I have 3 tables with the following columns:

tblClients [ClientID, ClientName, Client Contact]
tblEvents [EventID, EventName]
tblEventBook [EventBookID, EventID, ClientID]


tblEventBook EventID matches tblEvents EventID

tblEventBook ClientID matches tblClients ClientID


I have two parameters, @useEventID and @useClientID

I like to retrieve all records from tblClient where tblEventBook not equals useEventID and useClientID.

I tried to use the below, but it does not works.

SELECT * FROM tblClients 
WHERE tblEventBook.EventID <> @useEventID
AND tblEventBook.ClientID <> @useClientID

No comments:

Post a Comment