Registriert seit: 29. Nov 2010
3.072 Beiträge
Delphi 2010 Enterprise
|
AW: nested joins check
15. Jun 2020, 20:04
even more formatting (quite usefull for understanding what's going on)
PHP-Quellcode:
Select Distinct dm.column17 cell,
dm.column3 auto_id,
dm.column5,
dm.column8 Mod_Status,
dmZ.column3 BAT,
dm7.column4 MOD_VST_ID,
dm7.column8 Mod_Status,
dm7.ST_DATUM,
dm7.column12 STATUS,
DMZ.Date, DMDZ.IR, DMDZ.CAP,
DMDZ.UOCV2, DMDZ.DOCV2, DMDZ.UOCV3,
DMDZ.DOCV3, DMDZ.UOCV4, DMDZ.DOCV4,
DMDZ.SDR, DMDZ.UBS, DMDZ.DBS,
DMDZ.WEIGHT, DMDZ.THICKNESS
from Data dm
Inner join (Select PRFNR, column5, column6, column7, column15 from dat_messung
where column2 = '1850' and column5 is not null) dm4
on dm.column19 = dm4.column5
Inner join (Select column15, column5, column6, column7 from dat_messung
where column6 is not null) dm5
on dm4.column6 = dm5.column6
Inner join (Select column15, column6, column7, PRFNR
from dat_messung where column6 is not null) dm6
on dm5.column7 = dm6.column6
Inner join (Select DATUM ST_DATUM,
column12 ST_Status,
PRFNR,
column7,
column8
from dat_messung
where (column2 = '1330' or column2 = '1360') and column7 is not null) dm7
on dm6.column7 = dm7.column7
left join (Select Distinct PRFNR PRFNRZ, column3, DATUM Date
from DB1.Tools) DMZ
ON dm6.colum6 = DMZ.column3
LEFT JOIN (Select *
from (SELECT Distinct PRFNR PRFNRX, MNR, X1
FROM ACCU_ZELLE.dat_messungdaten
where MNR In
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14))
PIVOT(Max(X1)
For(MNR) IN(1 Voltage1,
2 Voltage2,
3 Current1,
4 Current2,
5 Resistane,
6 Impedance,
7 Width,
8 Height,
11 Length,
12 WEIGHT,
13 THICKNESS))) DMDZ
ON DMZ.PRFNRZ = DMDZ.PRFNRX
where (dm.DATUM > Sysdate - 60)
Now, that's that. But Your Question cannot be answered!
There is no data model, there is no data, there are not even a lot of usefull Fieldnames, giving ideas...
It looks like oracle database sql. And Yes, You can do all these joins, nested or chained, no problem. You can do pivot and select * operations .. no problem.
And to be honest, I didn't do a syntax read. As long as You don't get (or mention) an error it's fine.
Gruß, Jo
|