tbl_cmp
usr_id | cmp_name | usr_fname |cmp_addr
tbl_usr
cmp_usr_id |cmp_id | cmp_usr_fname | cnt_status
I am trying query retrieve data from both at a time for ::
retrieve all data from tbl_cmp
but
retrieve only field from tbl_usr that cnt_status=1
I tried this
SELECT *
FROM tbl_cmp
JOIN tbl_usr ON tbl_usr.cmp_id = tbl_cmp.usr_id
WHERE tbl_usr.cnt_status =1
but it shows only record that has cnt_status=1 not all record from first table
Try this