exclude

Thread Solved

Join Date: Nov 2007
Posts: 81
Reputation: lifeworks is an unknown quantity at this point 
Solved Threads: 2
lifeworks lifeworks is offline Offline
Junior Poster in Training

exclude

 
0
  #1
22 Days Ago
hi

i have two tables, one is products, the other is for 'discounts' on those products... when adding a new 'discount' i want to avoid adding two discounts to a single product... so i was looking for some sort of Right Join which would exclude all products which have a match in the discount table?!

Ill be using a 'select' to choose a product to add a discount to... the query needs to output all product name without a corresponding discount entry...

any ideas?

lworks
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 827
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 135
Sponsor
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Practically a Posting Shark
 
2
  #2
22 Days Ago
Something like this:
  1. SELECT * FROM product WHERE id NOT IN (SELECT product_id FROM discount)
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 81
Reputation: lifeworks is an unknown quantity at this point 
Solved Threads: 2
lifeworks lifeworks is offline Offline
Junior Poster in Training
 
0
  #3
22 Days Ago
nice one! worked great.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC