Question
Query of Query Neccessary?
Guess I'm losing it.
I have a table of locations - key field = location_ID.
Another (lookup) table has fire code violations - a location can have no or many violations (many to one).
FKey = violation_location_ID
I simply want to display a locations in rows with, among other data, a simple yes or no (have or have not had a violation)
This gets all locations:
<cfquery name="get_location" datasource="#Request.BaseDSN#">
SELECT location_ID, location_name, location_num, location_street, alarm_test_date, sprinkler_test_date, suppression_test_date
FROM location_main
ORDER BY location_name
</cfquery>
This gets only locations that have had violations:
<cfquery name="get_violation" datasource="#Request.BaseDSN#">
SELECT location_ID, violation_location_ID
FROM location_main, lookup_violation
WHERE location_ID = violation_location_ID
</cfquery>
Would I use the outputs of both queries in another query to determine yes or no for each returned record?
Thanks for helping get my head back on straight...
newportri
I have a table of locations - key field = location_ID.
Another (lookup) table has fire code violations - a location can have no or many violations (many to one).
FKey = violation_location_ID
I simply want to display a locations in rows with, among other data, a simple yes or no (have or have not had a violation)
This gets all locations:
<cfquery name="get_location" datasource="#Request.BaseDSN#">
SELECT location_ID, location_name, location_num, location_street, alarm_test_date, sprinkler_test_date, suppression_test_date
FROM location_main
ORDER BY location_name
</cfquery>
This gets only locations that have had violations:
<cfquery name="get_violation" datasource="#Request.BaseDSN#">
SELECT location_ID, violation_location_ID
FROM location_main, lookup_violation
WHERE location_ID = violation_location_ID
</cfquery>
Would I use the outputs of both queries in another query to determine yes or no for each returned record?
Thanks for helping get my head back on straight...
newportri
