arcware
10-31-2007, 03:29 AM
Hi,
I have 2 tables, tbl_cards (id, cardname) and tbl_crdservices (cardId,serviceId).
I need to fetch data from tbl_card where the cardname should have services in tbl_cardservice. For ex. select all cards which provide serviceId 5 and 6. I can use IN keyword Like Select c.* from tbl_cards c INNER JOIN tbl_cardServices cs ON c.Id = cs.CardId and cs.ServiceID IN (5,6)
but... IN keyword gives result on OR basis, means cards having id 5 or 6 will be returned, and I need result where the card having both services should return.
Please help.
Thanks
I have 2 tables, tbl_cards (id, cardname) and tbl_crdservices (cardId,serviceId).
I need to fetch data from tbl_card where the cardname should have services in tbl_cardservice. For ex. select all cards which provide serviceId 5 and 6. I can use IN keyword Like Select c.* from tbl_cards c INNER JOIN tbl_cardServices cs ON c.Id = cs.CardId and cs.ServiceID IN (5,6)
but... IN keyword gives result on OR basis, means cards having id 5 or 6 will be returned, and I need result where the card having both services should return.
Please help.
Thanks