Guys anybody has an idea or is it feasible to return this data using a particular query?
![]()
Guys anybody has an idea or is it feasible to return this data using a particular query?
![]()
bro, i'm willing to help however our firewall is blocking any attachments. is it possible to have it as plain text?
Medyo pareha man ni atong usa ka post last week.
Use joins (left outer/inner, right... etc... in mysql):
e.g.
(assuming T1.CSTH = T2.CSTH foreign key)SELECT T1.CSTH, T1.SEIB, T1.BUBA, T1.QTYINVCD, T2.QTYINVCD_2, T1.IPADDRESS
FROM TABLE1 T1
LEFT OUTER JOIN TABLE2 T2 ON T1.CSTH = T2.CSTH
i'm not sure if this will return your expected output wala ko ni na-test sa ako local but sulayi lang. try experimenting with joins.
table1:
Csth seib buba qtyinvcd ipadress
==================================
6845 | 76220 | t159 | 10000 | 172.29.8.28
6845 | 76220 | t159 | 10000 | 172.29.8.28
6845 | 76220 | t159 | 10000 | 172.29.8.28
6845 | 76220 | t159 | 20000 | 172.29.8.28
table2:
Csth seib buba qtyinvcd_2 ipadress
==================================
6845 | 76220 | t159 | 50000 | 172.29.8.28
6845 | 76220 | t159 | -20000 | 172.29.8.28
6845 | 76220 | t159 | 20000 | 172.29.8.28
expected result:
Csth seib buba qtyinvcd qtyinvcd_2 ipadress
===========================================
6845 | 76220 | t159 | 10000 | 50000 | 172.29.8.28
6845 | 76220 | t159 | 10000 |-20000 | 172.29.8.28
6845 | 76220 | t159 | 10000 | 20000 | 172.29.8.28
6845 | 76220 | t159 | 20000 | 0 | 172.29.8.28
select t1.csth, t1.seib, t1.buba, t1.qtyinvcd, t2.qtyinvcd_2, t1.ipadress from table1 t1 inner join table2 t2 on t1.csth = t2.csth
group by t1.csth
-- use inner join and group by 'csth'
Similar Threads |
|