SELECT     *
FROM riders, races
WHERE riders.raceid = races.raceid
ORDER BY race_name

<cfoutput query="qRaces" group"race_name">
#qRaces.race_name# ...
<cfoutput>
#qRaces.ridername# ...
</cfoutput>
</cfoutput>

Also, don't do SELECT * but select the fields you need.

Pascal

> -----Original Message-----
> From: Jeff Fongemie [mailto:[EMAIL PROTECTED]
> Sent: 27 July 2004 20:56
> To: CF-Talk
> Subject: sql question
>
> Hey everyone.
>
> I'm stumped.
>
> I need to be able to display a list of bicycle races, and under the
race
> list the riders names and positions. I'd like to have two tables so
the
> admin adding the  data only needs to enter the race name and date
once,
> then adds the riders in a seperate table linked by a raceid.
>
> Right now I've got two tables, one for the races, one for riders
linked by
> common field raceid.
>
> The above seems fine, but I'm having trouble querring and displaying
> results. What I need should look like this:
>
> RACE NAME, DATE, COUNTRY
> ridername, place, team
> ridername, place team
> ridername, place team
>
> RACE NAME, DATE, COUNTRY
> ridername, place, team
> ridername, place, team
>
> and so on.
>
> Display the race info once, and then the riders under that.
>
> Do I join at the query? Group at the query? Group at the output?
> This shows me everything:
> SELECT     *
> FROM riders, races
> WHERE riders.raceid=races.raceid
>
>
>
> I wish I could do this:
> SELECT     *
> FROM riders, races
> WHERE riders.raceid=races.raceid
> Group By Raceid
>
> Any suggestions would be most appraciated.
>
> Thanks,
>
> JF
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to