MySQL Forums
Forum List  »  Oracle

Re: How to use minus in mysql
Posted by: Megan Mercy
Date: July 06, 2010 06:44AM

To transform the statement

SELECT member_id, name FROM a
MINUS
SELECT member_id, name FROM b

The easy-to-understand transformation is:

SELECT DISTINCT member_id, name
FROM a
WHERE (member_id, name) NOT IN
(SELECT member_id, name FROM table2);


SELECT DISTINCT a.member_id, a.name
FROM a LEFT JOIN b USING (member_id, name)
WHERE b.member_id IS NULL

http://www.etaxportal.com/

Options: ReplyQuote


Subject
Views
Written By
Posted
50665
June 20, 2010 11:31PM
Re: How to use minus in mysql
19882
July 06, 2010 06:44AM
7770
July 08, 2010 04:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.