473,666 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Two or more select statements in a single query

28 New Member
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.CAL IBRATION.CAL_TY PE,
SYSTEM2.dbo.CAL IBRATION.CAL_TI MESTAMP, SYSTEM2.dbo.CAL IBRATION.MEASUR ED_VAL, SYSTEM2.dbo.CAL IBRATION.EXPECT ED_VAL
FROM SYSTEM2.dbo.CAL IBRATION INNER JOIN
dbo.SYS_PARAMS ON SYSTEM2.dbo.CAL IBRATION.PARAME TER_INDEX = dbo.SYS_PARAMS. PARAMETER_INDEX INNER JOIN
dbo.REPORT_PARA METERS ON dbo.SYS_PARAMS. PARAMETER_INDEX = dbo.REPORT_PARA METERS.PARAMETE R_INDEX AND
dbo.REPORT_PARA METERS.REPORT_I NDEX = 530 AND SYSTEM2.dbo.CAL IBRATION.CAL_TY PE IN ('qtr_low', 'Qtr_high', 'Qtr_mid')

----------------------------------------
select SYSTEM2.dbo.CAL IBRATION.expect ed_val-SYSTEM2.dbo.CAL IBRATION.measur ed_val as LOW_DIFF where cal_type='QTR_L OW'
-----------------------------------------

select SYSTEM2.dbo.CAL IBRATION.expect ed_val-SYSTEM2.dbo.CAL IBRATION.measur ed_val as MID_DIFF where cal_type='QTR_M ID'

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

select SYSTEM2.dbo.CAL IBRATION.expect ed_val-SYSTEM2.dbo.CAL IBRATION.measur ed_val as HIGH_DIFF where cal_type='QTR_H IGH'

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

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,Expec ted_val,measure d_val,result,LO W_DIFF,HIGH_DIF F,MID_DIFF


pls any one help me with this
Mar 10 '09 #1
1 3615
ck9663
2,878 Recognized Expert Specialist
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
2727
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 the iSeries Client Access Driver ver 10.00.04.00 to connect to the database. The problem is that executing the exact same SQL select statement more than twice int a row stops produces results. The first two instances will always produce the...
5
11501
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 { CarsSoldID int (primary key) MonthID int DealershipID int NumberCarsSold int
1
2127
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 stored procedure we believe is at fault, after which no error check was being performed. Under certain conditions, this update is fired against the same record in the same table as the immediately preceding update statement within
15
2732
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 start at the bottom. What seems to plague many ORM systems is the syntactic confusion and string-manipulation required to build the SQL Statements. If you want to do a Left Outer Join, support nested functions, and a nested conditional clause, you'd...
2
5480
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, produce a "function not defined" message when the SELECT statement is executed, even having previously worked on that machine. What can I do to correct this difficulty when it occurs? What do I need to know about user-defined functions in SELECT...
2
1577
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
1447
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 checkboxlists for each table that the user selects to query. I disable selecting non-related tables, and am in the process of creating inner joins when tables are related.... This is where I am getting stuck, here is the logic which builds the join...
4
1773
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, SvcDate2 etc. I would like to query certain data for monthly periods. The date of the month may appear in any one of the six fields. I now am running the query for each of the fields separately. Is there any way I can write a query that will respond...
3
2834
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 dataset to data in a second dataset, using a common key. I will first describe the problem in words and then I will show my code, which has most of the solution done already. I have built an ASP.NET that queries an Index Server and returns a...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8783
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8552
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.