AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

nested joins check

Ein Thema von piedad · begonnen am 15. Jun 2020 · letzter Beitrag vom 18. Jun 2020
 
piedad

Registriert seit: 5. Jun 2020
10 Beiträge
 
#1

nested joins check

  Alt 15. Jun 2020, 09:39
Datenbank: SQL • Version: QDA Version9 • Zugriff über: Delphi
Hallo guys,
I do not really know if either my measured data or my code are not ok. Could you take a look at my Code and give me your feedback, if it is ok to Programm it in this way?
thanks in Advance and Kind regards
Piedad

I have three Databases to join and extract data from:
1st global database with Electric measured data: DB1.Measurements with a Primary key: PRFNR and columns: ID_Long ,Voltage, current,Length, Count,ESD,...
2nd data base with measurement proceduresB1.Tools with a Primary key: PRFNR and columns ID_Long,tools,conditions
3rd Database Linedata: DB2.Data with Primary key ID_Long(just in one Station) and columns ID_short, machinenumber,Date, Status,para1,para2,para3,...
I Need to pick up the Long ID which is only posible to find in the Database DB1.Measurements which corresponds to several Shorts IDs to find in the DB2.Data.
I tried following Code and got some short ID Right results and some result with short ID's belonging to another Databases DB3 and 4.
this is my Code:

Code:
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 )

Geändert von Daniel (15. Jun 2020 um 09:47 Uhr) Grund: applied code-formatting
  Mit Zitat antworten Zitat
 

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:39 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz