| | |
exclude
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 81
Reputation:
Solved Threads: 2
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
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
2
#2 22 Days Ago
Something like this:
MySQL Syntax (Toggle Plain Text)
SELECT * FROM product WHERE id NOT IN (SELECT product_id FROM discount)
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
![]() |
Similar Threads
- How can I exclude the search engine bots on a Coldfusion website? (Search Engine Optimization)
- 301 Redirect all .htm but Exclude Specific Files, Directory (IT Professionals' Lounge)
- Is it possible to exclude leaf nodes dynamically using XPATH? (XML, XSLT and XPATH)
- calculate the date difference between two dates exclude the saturday and sunday (Java)
- exclude comments using Regular Expressions (C#)
- have you ever abused ur powers? (Geeks' Lounge)
- BASIC FORM problems... (PHP)
- find 4 you (Windows NT / 2000 / XP)
Other Threads in the MySQL Forum
- Previous Thread: Remove last chars
- Next Thread: .sql file loses characters
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





