473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Two or more select statements in a single query

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
1 3602
ck9663
2,878 Expert 2GB
Try to match your columns then use UNION


-- CK
Mar 10 '09 #2

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

Similar topics

13
by: Wescotte | last post by:
Here is a small sample program I wrote in PHP (running off Apache 1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data base is using DB2 V5R3M0. The client is WinXP machine using...
5
by: malcolm | last post by:
Example, suppose you have these 2 tables (NOTE: My example is totally different, but I'm simply trying to setup the a simpler version, so excuse the bad design; not the point here) CarsSold {...
1
by: M Wells | last post by:
Hi All, Further to my previous long-winded question about a situation in which we appear to be mysteriously losing data from our mssql2k server. We discovered an update statement, in the...
15
by: grunar | last post by:
After some thought on what I need in a Python ORM (multiple primary keys, complex joins, case statements etc.), and after having built these libraries for other un-named languages, I decided to...
2
by: David Emme | last post by:
Access 97 I have a number of SELECT statements which contain references to user-defined VBA functions. These typically work as expected, but occasionally, on one user's machine or another,...
2
by: jeffvh | last post by:
I have 2 tables related as: T1.KEY, T1.FIELD1, T1.FIELD2 T2.KEY, T2.FIELDA, T2.FIELDB T2.KEY, T2.FIELDA, T2.FIELDB T1.KEY = T2.KEY I want to return a SELECT as:
1
by: KBuser | last post by:
Preface: I'm building an intranet site to build custom queries against our SQL Server (2000) db; The page is developed in ASP.net (2.0) with C# Codebehind. I dynamically generate and populate...
4
by: Stan | last post by:
I am running in ACCESS 2003 a database with a single table. It records service rendered to clients of a food pantry. As each client is served the date is entered into 1-6 fields SvcDate1,...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.