Complex Query Ole  2015-07-14 00:59
Status: Closed
 
Hi,

sorry for my late response. I'm traveling a lot at the moment and will in the next time.

For example I use such code for calculating different elements:

#########################################################
SELECT rawdata_ic.labID, sampletable_solids.label,
-----------------Chlorid
CASE
    WHEN (rawdata_ic.Cl/rawdata_ic.Cl_factor) <= loq_ic.Cl THEN '< NWG'
    WHEN (rawdata_ic.Cl/rawdata_ic.Cl_factor) <= loq_ic.Cl*3 THEN '< BG'
    ELSE TO_CHAR((rawdata_ic.Cl*rawdata_ic.sample_volume/rawdata_ic.sample_weight), '999G990')
END AS "Cl [mg/kg]",
------------------Bromid
CASE
    WHEN (rawdata_ic.Br/rawdata_ic.Br_factor) <= loq_ic.Br THEN '< NWG'
    WHEN (rawdata_ic.Br/rawdata_ic.Br_factor) <= loq_ic.Br*3 THEN '< BG'
    ELSE TO_CHAR((rawdata_ic.Br*rawdata_ic.sample_volume/rawdata_ic.sample_weight), '999G990D999')
END AS "Br [mg/kg]"
-------------------
FROM
    Project."XXX".lists.sampletable_solids,
    Project."XXX".lists.rawdata_ic,
    "XXX".lists.loq_ic,
WHERE
    sampletable_solids.labID = rawdata_ic.labID AND
    loq_icpoes.icpID LIKE 'loq_001'
ORDER BY
    rawdata_ic.labID
#########################################################

Repeating over and over for different elements. It would be much easier to just simply fill a loop with the according elements and only have one "fed printout-code".

Regards
Ole