|
Posted by Rich Ryan on 12/04/05 02:06
This problem pops up a lot in database newsgroups. If you remember, rule 1
is "no repeating groups". So to create a query that creates repeating groups
goes against the SQL model.
To do this in the most SQL way, Create a table like
CREATE TABLE PersonDegrees(
PersonID int,
IsRN char(1),
Is MD char(1),
IsPHD char(1),
....
....
IsLawyer Char(1))
Where Is...= 'Y' or 'N'
This looks likes a repeatng group, but it is not.
This way you can do queries like:
Show me people that are MDs, PHDs, and not Lawyers.
You can easily populate this table from your original M:M table.
Rich
"bika" <aesahab@gmail.com> wrote in message
news:1133571514.032416.98880@z14g2000cwz.googlegroups.com...
> I have a table that has values as follows:
> PersonID Degree
> 55 MD
> 55 Phd
> 55 RN
> 60 MD
> 60 Phd
>
> I need a create a query that will give me output like this:
>
> PersonID Degree
> 55 MD, Phd, RN
> 60 MD, Phd
>
> Any ideas
>
>
Navigation:
[Reply to this message]
|