473,699 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Write this SQL Statement?

1 New Member
Hi,

Table A
Col1 Col2 Col3 Col4

Table B
Col5

Both tables are not linked to each other.

Table 5 have Values (10, 17, 30) Only.

Query
I am currently executing query in the following way
Select Col1, Col2, Col3, Col4, 10 From TableA where Col4 = '2008-08-10';
Select Col1, Col2, Col3, Col4, 17 From TableA where Col4 = '2008-08-10';
Select Col1, Col2, Col3, Col4, 30 From TableA where Col4 = '2008-08-10';

I want to make one query so that I dont have run this statement thrice.

If I use union then have to change these dates and other conditions three times.

Select Col1, Col2, Col3, Col4, 10 From TableA where Col4 = '2008-08-10'
Union
Select Col1, Col2, Col3, Col4, 17 From TableA where Col4 = '2008-08-10'
Union
Select Col1, Col2, Col3, Col4, 30 From TableA where Col4 = '2008-08-10'

Is there a way I can get one SQL Statement which does the work which this statement isw doing (UNION ONE). Just tot avoid changing conditions every where.

Thanks
Rohit
Aug 14 '08 #1
0 1188

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

Similar topics

0
1753
by: hari krishna | last post by:
hi all, My requirement is to generate xl reports throu Asp.Net without installing xl on web server computer. i am using Response object and wrtifile method as below. i dont know whether it is correct, but giving error says " file is accessed by other process cannot access" I have some logic inbetween and write the info using response.write in to html format Ex: Response.Write("<td>" & "client_no" & "</td>"). I am getting the error at :...
2
3877
by: Jack | last post by:
Hi, I am trying to check for the final sql statement before passing it to a database. I want to build the statement using user input in three text boxes. However, the sql statement does not give me the right statement. Instead it gives the following message: Error Type: Request object, ASP 0102 (0x80004005) The function expects a string as input. /sailors/loginverification1.asp, line 14 CODE:
1
3252
by: Kevin Potter | last post by:
We have an application that has been running on IIS4 and IIS5 for quite some time, without problem We're now migrating to IIS6 (windows/2003), and have run into a what might? be a Javascipt problem/question... The snippet of code in question is: <script language="JavaScript"><!-- document.write("<script src='/fp/"+includename+"'></script>"); // -->></script>
4
2949
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400, like DOS, uses memory-mapped display, two bytes per character (one char byte and one attribute byte). We can get the screen offset allright, and I've written a javascript which does the math to convert the offset into row/col (i.e. left, top)...
3
3409
by: TD | last post by:
I have an unbound form that adds and updates records to one table. I use an INSERT sql statment to add a new record and a UPDATE statement to update a record. I created a function named C2F to check each field for null. If the field is null I need to write the value null to the table. This is a sniplet of the UPDATE sql statement: sql = sql & "SSP4_Cut = '" & C2F(SSP4_Cut) & "', " that is:
1
8061
by: =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?= | last post by:
Hello All, Our application write logs to a file in a folder. Before our application starts writing to that file, I want to check if the current user has write access to that file, for example, "c:\temp\LogFile.txt". I see several articles for setting file access permissions, getting file access permissions for a given user or current user - but the current user could also gain write access to the same file not just by explicit permssion...
12
2094
by: =?Utf-8?B?Smlt?= | last post by:
I have code that reads and parses a text file using a schema.ini file. Works great. When I see the dataGrid it's exactly what I want. Dim CString As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\;" & _ "Extended Properties=""text;HDR=No;""" Dim TConnect As New System.Data.OleDb.OleDbConnection(CString)
23
2992
by: asit dhal | last post by:
hello friends, can anyone explain me how to use read() write() function in C. and also how to read a file from disk and show it on the monitor using onlu read(), write() function ??????
2
1660
by: chrisf01 | last post by:
I am trying to write to a text file and the database at the same time. I have a For statement that loops through all the repeated fields in my form and writes it to a text file. That part works 100% without a problem. My problem is that I also want to write to the SQL database at the same time and anytime I put the sql stored procedure inside the same For statement I get a http 500 error. Do I need to do this outside of the current For...
3
6815
by: Alan Mailer | last post by:
Ok, I've looked for an answer for this, because I'm sure it's been asked a thousand times... but no luck... so here goes. Imagine I want to create a NodeList based on an XPath statement. The 'query' portion of that statement wants to search for the following value: Joe's Garage ....now please note the APOSTROPHE in the above string.
0
8685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9032
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...
0
7745
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
4374
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
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
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.