How can I get several hyperlinks to display in the query output?

I uses two tables to list all a school sport teams. The table of sport lists all team data aggregated by gender. The second table uses the sportID of the first table to associate a team calendar.  The problem is not all the teams do not have a calendar.

I'm trying to post a link to these teams with schedules. I compare the two tables, the sport and the calendar and a CFIF statement allows to compare the 2 sportIDs in the output to determine the teams who have a schedule.  If the two sportIDs corresponds to a hyperlink is displayed.

Unfortuanetely, only one link will be displayed, even if there should be three links. Here is my code:

Table to display aggregated by gender teams

"< name cfquery ="getSports"datasource =" #application.database # "" >

Choose between the sexes, team, levels, sportID

sports

Group sex, team, levels, sportID

< / cfquery >

Table used for the sportID of already created calendars

< name cfquery = "getID" datasource = "#application.database #" >

Select sportID

annexes

SportID group

< / cfquery >

I then compare the sportIDs and if they match, I then display a hyperlink

"< cfoutput query ="getSports"group 'sex' = >"

< h1 "> teams #gender < / h1 >"

< ul >

< cfoutput >

< li >

< cfif getID.sportID EQ getSports.sportID > <a href = "teams.cfm? sportID = #sportID #" >< / cfif >

#team # < cfif levels GT "" >(#levels#) < / cfif > //levels is used to differentiate the J.V. and Varsity. "." Usage levels not all of the teams

< cfif getID.sportID EQ getSports.sportID > </ a >< / cfif >

< /li >

< / cfoutput >

< /ul >

< / cfoutput >

How can I get the other teams to display their links?

Thank you gentlemen, since everyone was suggesting an outer join, I took out my trusty Manual of ColdFusion and learn about them. I've added the sum() for the query:

Select sports.gender, sports.team, sports.levels, sports.sportID, sum (schedules.sportID) AS expected

sports

opening hours of the outer join left on sports.sportID = schedules.sportID

Group of sports.gender, sports.team, sports.levels, sports.sportID

So add the following to the output:

And everything works perfectly. Once again, life is beautiful!

Tags: ColdFusion

Similar Questions

Maybe you are looking for