Re: Thanks! Re: SQL query

From: Jeffrey Barnett <jeffrey.barnett_at_nyob>
Date: Fri, 26 Jan 2007 10:35:38 -0500
To: CODE4LIB_at_listserv.nd.edu
You have gotten a lot of suggestions, but here is one more.

select * from lib_books where good_thing = 'TRUE'
MINUS
select * from lib_books where bad_thing = 'TRUE'

I think MINUS is faster than JOIN.

Other SET OPERATIONS include UNION and INTERSECT.

Set operations require that the underlying result sets be "compatible":
Same number of columns.
Corresponding columns have matching datatypes.


Ken Irwin wrote:
> Hi all,
>
> Thanks for these myriad responses! I've gotten at least three distinct
> approaches to try. I knew there had to be a better way.
>
> your sql-fu is appreciated!
>
> joys
> Ken


Received on Fri Jan 26 2007 - 09:37:43 EST