Database Query Output - Suggestions Please!
Hi guys,
I'm a beginner at Coldfusion and I'd like your advice on what to do with an issue I have.
I currently have 3 related database queries that return results from 3 different tables in my database. I'd like the listed output from the second query to feature the name column of its specific row (these are 'eevent' in the query 'events' and 'Nname' in the Query 'artists'). Currently I'm only able to display the ID column from the second query. For example, I'd like the name from the 'artist' query rather than simply the 'artistID' from the 'applied' query.
I'm unsure of how to go about this and would greatly appreciate any suggestions anyone might have?
Here is my code:
<!--- THIS FINDS OUT THE PROMOTERS EVENTS --->
<cfquery name="events" datasource="071907cs07to">
SELECT eventID, eevent
FROM Event
WHERE epromoterID = #SESSION.auth.PromoterID#
</cfquery>
<!--- THEN THE APPLIED LIST FROM THOSE EVENTS --->
<cfquery name="applied" datasource="071907cs07to">
SELECT eventID, artistID
FROM Applied
WHERE eventID IN (#ValueList(events.eventID)#)
</cfquery>
<!--- THEN THE ARTIST NAMES FROM THOSE APPLICATIONS --->
<cfquery name="artists" datasource="071907cs07to">
SELECT Nname, artistID
FROM Artist
WHERE artistID IN (#ValueList(applied.artistID)#)
</cfquery>
<table class="main">
<cfoutput query="applied">
<tr>
<td>
'#artistID#'
would like to play:
#eventID#.
</td>
</tr>
</cfoutput>
</table>
Currently, the code is returning the ID numbers - I'd like to know if it's possible to output the names of the artists and events from the other two queries instead?
Thanks,
Tom
