Reputation: 15
I have been wanting to ignore the repeating values by using join from multiple tables but seems like I could not find any way of my own to do it
i have three mysql tables
**tec_noti_send**
-------------
oid name
-------------
1 ali
2 ahmed
3 john
4 king
**tec_feedback_noti**
-------------
fid teacherreplied
-------------
1 TRUE
2 TRUE
**tec_query_noti**
-------------
tqid tqnoti_got_student
-------------
1 john smith
2 harry smith
3 suzane smith
query I used
SELECT DISTINCT
tec_noti_send.*,
tec_feedback_noti.*,
tec_query_noti.*
FROM tec_noti_send
INNER JOIN tec_feedback_noti
INNER JOIN tec_query_noti
Result I want
**join at once with no common column and auto incremented column**
-------------------------------------------------------
temorary
id name fid teacherreplied tqid tqnoti_got_student
--------------------------------------------------------
1 ali 1 TRUE 1 john smith
2 ahmed 2 TRUE 2 harry smith
3 john 3 suzane smith
4 king
Upvotes: 0
Views: 163
Reputation: 133370
You should use left join
SELECT DISTINCT
tec_noti_send.*,
tec_feedback_noti.*,
tec_query_noti.*
FROM tec_noti_send
LEFT JOIN tec_feedback_noti on tec_noti_send.oid = tec_feedback_noti.fid
LEFT JOIN tec_query_noti on tec_noti_send.oid = tec_query_noti.tqid
Upvotes: 1