Re: simple sql question

From: Anders Altberg (x_pragma_at_telia.com)
Date: 05/05/04


Date: Wed, 5 May 2004 15:02:22 +0200

SELECT reader FROM BooksRead WHERE book in ('A','B') ;
GROUP BY reader HAVING COUNT(DISTINCT Book)>=2

-Anders

"toylet" <toylet@mail.hongkong.com> wrote in message
news:slrnc9hg3t.hbp.toylet@server.donkeyware.org...
> given this table booksread:
>
> reader title
> ------ -----
> 001 A
> 002 B
> 001 B
> 003 C
> 004 A
>
> I want to list the readers that read titles "A" and "B".
> Any better solution than the following query?
>
> select distinct reader
> from booksread
> where reader in
> ( select reader from booksread where title="A")
> and reader in
> ( select reader from booksread where title="B")
>
> --
> .~. Might, Courage, Vision. In Linux We Trust.
> / v \ http://www.linux-sxs.org
> /( _ )\ Linux 2.4.26
> ^ ^ 6:18pm up 4 days 19:41 load average: 1.02 1.01 0.98



Relevant Pages

  • Re: simple sql question
    ... select distinct reader, title from booksread into cursor tmp ... Gregory ...
    (microsoft.public.fox.vfp.queries-sql)
  • Re: simple sql question
    ... Select reader; ... toylet wrote: ... > given this table booksread: ... > select distinct reader ...
    (microsoft.public.fox.vfp.queries-sql)
  • simple sql question
    ... given this table booksread: ... Any better solution than the following query? ... select distinct reader ...
    (microsoft.public.fox.vfp.queries-sql)
  • (linux vs windows) Ed Fosters Gripeline....
    ... The Reader Advocate Column ... Readers Debate Open Source Vs Windows ... How viable an alternative to Microsoft is Linux and other open source ... "I've already replaced Microsoft Office in my entire company with Open ...
    (sci.research.careers)
  • [Full-Disclosure] A real-life story (no analogies) Was: Anti-MS drivel
    ... with comparing linux and windows I found out I have something that I ... Scenario now forks in two branches: one for giving up old scanner ... Going for the flash card reader. ... Connecting it to my USB hub. ...
    (Full-Disclosure)