Hi Ole,
I'm confused as to what you mean when you say you're "'manually' calculating each element1 & element2 concentrations" here.
Looking at your table examples, you only have one table listing element concentrations. So what is this calculation you're having to do manually? Can you provide us with your SQL code that you're using that is producing this result table so we can get a better understanding to what you're doing?
Regards,
Jon |
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 |
I would recommend either (a) writing a script to create the sql for you or (b) de-pivot the rawdata_ic table into a long and skinny table along the lines of (labid, name, value). If you de-pivot the table, you can probably just do a simple query and wrap it in a pivot query. |