By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,856 Members | 2,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,856 IT Pros & Developers. It's quick & easy.

Two or more select statements in a single query

P: 28
How to write two or more select statements in a single query

here my requirement is

SELECT dbo.SYS_PARAMS.PARAMETER_NAME, dbo.SYS_PARAMS.PARAMETER_UNITS, SYSTEM2.dbo.CALIBRATION.CAL_TYPE,
SYSTEM2.dbo.CALIBRATION.CAL_TIMESTAMP, SYSTEM2.dbo.CALIBRATION.MEASURED_VAL, SYSTEM2.dbo.CALIBRATION.EXPECTED_VAL
FROM SYSTEM2.dbo.CALIBRATION INNER JOIN
dbo.SYS_PARAMS ON SYSTEM2.dbo.CALIBRATION.PARAMETER_INDEX = dbo.SYS_PARAMS.PARAMETER_INDEX INNER JOIN
dbo.REPORT_PARAMETERS ON dbo.SYS_PARAMS.PARAMETER_INDEX = dbo.REPORT_PARAMETERS.PARAMETER_INDEX AND
dbo.REPORT_PARAMETERS.REPORT_INDEX = 530 AND SYSTEM2.dbo.CALIBRATION.CAL_TYPE IN ('qtr_low', 'Qtr_high', 'Qtr_mid')

----------------------------------------
select SYSTEM2.dbo.CALIBRATION.expected_val-SYSTEM2.dbo.CALIBRATION.measured_val as LOW_DIFF where cal_type='QTR_LOW'
-----------------------------------------

select SYSTEM2.dbo.CALIBRATION.expected_val-SYSTEM2.dbo.CALIBRATION.measured_val as MID_DIFF where cal_type='QTR_MID'

----------------------------------------------------

select SYSTEM2.dbo.CALIBRATION.expected_val-SYSTEM2.dbo.CALIBRATION.measured_val as HIGH_DIFF where cal_type='QTR_HIGH'

-------------------------------------

i want to combine all these statements form in a single query as a view


after creating view i have to bind this view to crystal report and i want to use all those fields

Timestamp,Expected_val,measured_val,result,LOW_DIF F,HIGH_DIFF,MID_DIFF


pls any one help me with this
Mar 10 '09 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
Try to match your columns then use UNION


-- CK
Mar 10 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.