question

sameed avatar image
sameed asked

i am not getting correct email from the query . what can be a reason

cms_user(user_id, email, password,type) cms_reseller_slots(reseller_id , slots) cms_Credit_transfer(transfer_id, sender_id, receiver_id) these are the three tables. i want to get email id of receiver_id i have written the below query but not getting any result, if getting , they are not correct SELECT u.email FROM cms_user u JOIN cms_reseller_slots r ON ( u.user_id = r.reseller_id ) JOIN cms_credit_transfer c ON ( c.sender_id = r.reseller_id ) WHERE r.reseller_id =1 LIMIT 0 , 30;
mysqlquery hints
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sameed avatar image sameed commented ·
just zero results. even in some r.reseller_id it is giving the result but thats not matching the correct email address in user table
0 Likes 0 ·
sameed avatar image sameed commented ·
with left join its giving some results, but still not giving all
0 Likes 0 ·
Conan avatar image Conan commented ·
if you want the email for the receiver_id shouldn't the last join be to c.receiver_id?
0 Likes 0 ·
sameed avatar image sameed commented ·
Yeah also tried that c.reciever_id too , actually i got the problem sorted, the content must also b entered explicitly in other tables,. thanks a lot for all ur replies. really appreciated
0 Likes 0 ·

1 Answer

·
JohnM avatar image
JohnM answered
With the inner joins, are there corresponding records in the cms_reseller_slots & cms_credit_transfer tables? Any error message or just zero results?
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.