Stored query

admin

Administrator
Staff member
Hi,

I can be more specific now...

I have this query
SELECT ROUTE_ID,COUNT(ROUTE_ID) AS numstops
FROM stop_visit_order,stop
WHERE stop_visit_order.STOP_ID=stop.STOP_ID
AND (STOP_DESC='VAR1') OR STOP_DESC='VAR2')
GROUP BY roue_ID
HAVING numstops 2;

I need to store the resulting ROUTE_ID's for the second query...

SELECT ROUTE_ID,ARRIVE_TIME
FROM stop_visit_time,stop
WHERE stop_visit_time.STOP_ID=stop.STOP_ID
AND STOP_DESC='VAR1'
AND stop_visit_time.ARRIVE_TIME>=#VAR3#
AND ROUTE_ID IN (results from 1st query);

I am not sure how to do it, do I need to have a table in order to store these temp results (but this will mean only one user at a time and it is a web based application!)
or an array but how can MYSQL talk to it and incorporate it into the second query?

Thanks for the help.
 
Back
Top