- Impact
- 38
I am trying to get all orders associated to a user with a unique $brokerid.
There are three tables to be pulled from (dates, order, sales) and the user information is stored in table users.
Order holds the primary key `id` and dates / sales contain the foreign key `id` to match.
RESOLVED.
SELECT DISTINCT o.id, o.status, d.submitdate, s.paymentstatus
FROM `order` AS o, `dates` AS d, `sales` AS s, `users` AS u
WHERE (
u.userid = o.broker
) && ( u.userid =2 ) && ( o.broker =2 ) && ( s.id = o.id ) && ( d.id = o.id )
ORDER BY `d`.`submitdate` DESC
LIMIT 0 , 30
There are three tables to be pulled from (dates, order, sales) and the user information is stored in table users.
Order holds the primary key `id` and dates / sales contain the foreign key `id` to match.
RESOLVED.
SELECT DISTINCT o.id, o.status, d.submitdate, s.paymentstatus
FROM `order` AS o, `dates` AS d, `sales` AS s, `users` AS u
WHERE (
u.userid = o.broker
) && ( u.userid =2 ) && ( o.broker =2 ) && ( s.id = o.id ) && ( d.id = o.id )
ORDER BY `d`.`submitdate` DESC
LIMIT 0 , 30
Last edited:










