mysql - how can i fetch table records through joins? -
lets suppose have database table x_tush in there column license,so each license 123 have n number of columns associated it,say address_id,status,address_type,etc. each license have n number of networks (101,102,108,113,114) 123 license there exist 3 records 101,102,114 , 2 records 108,113. please replicate records exist 101,102,114 113,108,as there 2 records associated it?
select * xpna;
-- networks needed
select distinct network x_pns_address network in (101,102,113,114,108
) temp aln;
-- identify license lest 5 network
select license,address_type ,contact ,address_line1,address_line2,city xpna network in (101,102,108,113,114) group license,address_type ,contact ,address_line1,address_line2,city having count(network) < 5 temp msn; select * msn,aln temp table1;
-- insert missing values in temp table
insert xpna select n.license, n.network, n.address_type , n.contact , n.address_line1, n.address_line2, n.city table1 n left join x_pns_address x on x.network = n.network , x.license = n.license group x.address_type x.license null; select * xpna;
Comments
Post a Comment