Re: Substract queries - Mailing list pgsql-sql

From Robins Tharakan
Subject Re: Substract queries
Date
Msg-id 36af4bed0805220827m1fb61247o62efcd48851f7d99@mail.gmail.com
Whole thread Raw
In response to Substract queries  ("Nacef LABIDI" <nacef.l@gmail.com>)
List pgsql-sql
<span style="font-family: verdana,sans-serif;">Probably you are looking for EXCEPT.</span><br style="font-family:
verdana,sans-serif;"/><br style="font-family: verdana,sans-serif;" /><span style="font-family:
verdana,sans-serif;">SELECT* FROM Tbl1 WHERE a=1</span><br style="font-family: verdana,sans-serif;" /><span
style="font-family:verdana,sans-serif;">EXCEPT </span><br style="font-family: verdana,sans-serif;" /><span
style="font-family:verdana,sans-serif;">SELECT * FROM tbl2 WHERE a=1 and b=1</span>;<br style="font-family:
verdana,sans-serif;"/><br style="font-family: verdana,sans-serif;" /><span style="font-family: verdana,sans-serif;"><a
href="http://www.postgresql.org/docs/8.3/interactive/sql-select.html">http://www.postgresql.org/docs/8.3/interactive/sql-select.html</a></span><br
style="font-family:verdana,sans-serif;" /><br style="font-family: verdana,sans-serif;" /><span style="font-family:
verdana,sans-serif;">Regards,</span><brstyle="font-family: verdana,sans-serif;" /><b style="font-family:
verdana,sans-serif;">RobinsTharakan</b><br /><br /><div class="gmail_quote">---------- Forwarded message ----------<br
/>From:<b class="gmail_sendername">Nacef LABIDI</b> <<a href="mailto:nacef.l@gmail.com">nacef.l@gmail.com</a>><br
/>Date:Thu, May 22, 2008 at 8:45 PM<br /> Subject: [SQL] Substract queries<br />To: <a
href="mailto:pgsql-sql@postgresql.org">pgsql-sql@postgresql.org</a><br/><br /><br />Hi all,<br /><br />I was wondering
howcan I substract result between select queries. I mean I want to issue a query that does this :<br /> (select * from
mytablewhere condition1) - (select * from mytable where condition2)<br /><br /> Thanks to all<br /><font
color="#888888"><br/>Nacef<br /></font></div><br /> 

pgsql-sql by date:

Previous
From: "Nacef LABIDI"
Date:
Subject: Substract queries
Next
From: Craig Ringer
Date:
Subject: Re: Substract queries