mysql - Select query issue with join -
hello please me one,
stent table
bal table
with stent_size 20 both table, current_status = co_qc_comeplete , status = added, 5 records, instead in select query got 50 recrods.. confused..
i want 5 records of stent table join of bal table , want 5 records bal table.
can me create select query one..
thanks in advance..
edit :
select * stent sd left join bal bd on sd.stent_size = bd.stent_size sd.current_status = "co_qc_complete" , sd.stent_size = "20" , bd.status = "added"
select * stent sd left join bal bd on sd.stent_size = bd.stent_size sd.current_status = "co_qc_complete" , sd.stent_size = "20" , bd.status = "added"
returns 50 records because takes of bal (10 records shown) , joins stent (5 records shown) stent_size = stent_size. (each bal record paired 5 stent records)
there nothing unique data save ids, can trouble when joining these tables.
thinking little more, , think wanting.
try this:
select distinct st.id, st.stent_material, st.stent_size, st.stock_qty, st.current_status, bal.diameter, bal.lot_no, bal.quantity, bal.received_from, bal.expiry_date, bal.status, bal.created_date, bal.modified_date stent st inner join bal on bal.stent_size = st. stent_size st.current_status = "co_qc_complete" , st.stent_size = "20" , bal.status = "added"
Comments
Post a Comment