vhats wrong with my query [subqueries ITT]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

vhats wrong with my query [subqueries ITT]

Post 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!
Last edited by bla5e on Tue Jul 13, 2010 4:07 pm, edited 1 time in total.
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Re: vhats wrong with my query

Post 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!
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Re: vhats wrong with my query

Post by bla5e »

Never mind my last post, it ONLY works when there is 1 record. Not Multiple records
Post Reply