It depends a lot on what db you are using. My DB (Openbase) knows how to
handle this:
Select Name from Person Where (Select Count(*) From Link Where
Link.pid=Personen.id)>1
Max
-> Maximilian Tyrtania | Mty at fischerAppelt dot de
fischerAppelt Kommunikation GmbH
Tucholskystr. 18 | D-10117 Berlin | Germany
Tel. ++49-30-726146-728 | Fax ++49-30-726146-710
www.fischerAppelt.de
_______________________________________________________________
+++mamamoto, die Initiative von Ligalux für ein neues Familienbild, ist am
10. März in Hamburg gestartet.
Damit Familie wieder sichtbar Spaß macht http://www.mamamoto.de +++
--
> Hello all,
>
> I hope some of you SQL wizards can help me figure this out:
>
> The statement below works perfectly. I get all student names in the
> class with a class id of "A"
> SELECT person.name FROM person, class, link WHERE link.pid=person.id
> AND link.cid=class.id AND class.id="A"
>
> What I can't figure out is how to get the names of students who are in
> TWO or more classes, "A" and "B", for example. In English: "Select
> all students who are in class A as well as class B". Or any
> combination of multiple classes: A&C, A,B&C, etc. Can that be
> accomplished in one select statement? I haven't been able to do that.
>
> db setup:
>
> Table: person
> Columns: id, Name
>
> Table: class
> Columns: id, Name
>
> Table: link
> Columns: pid, cid
>
> Thanks for any guidance. I'm really stumped.
>
> --
> Sean McCollum
> Mac OS 10.4.7
> RB 2006 r3 Pro
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|