Page 1 of 1

vhats wrong with my query [subqueries ITT]

Posted: Tue Jul 13, 2010 2:37 pm
by bla5e

Code: Select all

SELECT id,effortid,productid,
        (SELECT interval FROM auto_schedules_intervals WHERE scheduleid=auto_schedules.id) AS interval, 
        (SELECT description FROM templates WHERE id=auto_schedules_intervals.templateid) AS template 
FROM auto_schedules 
WHERE productid={$_SESSION['renewals_pub']};
ERROR: missing FROM-clause entry for table "auto_schedules_intervals"
LINE 1: ...rval, (SELECT description FROM templates WHERE id=auto_sched...
help!

Re: vhats wrong with my query

Posted: Tue Jul 13, 2010 3:06 pm
by bla5e

Code: Select all

SELECT id, effortid, productid,                                                                                                                  
             (SELECT interval FROM auto_schedules_intervals WHERE scheduleid=auto_schedules.id) AS interval                                    
            FROM auto_schedules                                                                                                                       
            WHERE productid={$_SESSION['renewals_pub']}
is working, but i need the description from the templates table too!

Re: vhats wrong with my query

Posted: Tue Jul 13, 2010 3:51 pm
by bla5e
Never mind my last post, it ONLY works when there is 1 record. Not Multiple records