im trieng to select data from 3 diffrent tables, i want to select the data and filter it that the fullname dont apper twice and the number of order from this fullname will grouped to one. i tried these query but it gave me an error, can you help me?
SELECT
`biz`.`id`,
`deals`.`biz_id`,
`deals`.`id` as `deal_id`,
`deals`.`name`,
`orders`.`id`,
`users`.`username`,
`users`.`fullname`,
`users`.`id` as `user_id`,
`orders`.`dealid`,
`orders`.`userid` ,
COUNT(`orders`.`userid`) as `num`
FROM
`deals`,
`users`,
`orders`
WHERE
`deals`.`biz_id` = '{$User['id']}'
AND `orders`.`dealid` = `deal_id`
AND `users_id` = `deals`.`userid`
In your statement, the first field you are selecting is ‘id’ field from ‘biz’ table. However, ‘biz’ table is not in your FROM clause.
I think I can guess how to fix it: