473,412 Members | 5,714 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,412 software developers and data experts.

SQL multiple statements?

Hi,

Is it possible to use multiple statements in SQL?? (I’ve never used it before)
:

I have one query that i'm working with, The statements I want to use are as
below, they all work individually, but not together, Access help is as much
use as a chocolate fireguard in this case! any suggestions or explainations
would be gratefully appreciated:

Thank you.

SELECT DATA_START_DATE, Left([DATA_START_DATE],4) AS DATA_START_DATE_year,
Mid([DATA_START_DATE],5,2) AS DATA_START_DATE_month, Mid([DATA_START_DATE],7,
2) AS DATA_START_DATE_day, DateSerial([DATA_START_DATE_year],
[DATA_START_DATE_month],[DATA_START_DATE_day]) AS DATA_START_DATE_date FROM
5F3_HEORG_IL_RF__20000101_0000_V01
SELECT DATA_END_DATE, Left([DATA_END_DATE],4) AS DATA_END_DATE_year, Mid(
[DATA_END_DATE],5,2) AS DATA_END_DATE_month, Mid([DATA_END_DATE],11,2) AS
DATA_END_DATE_day, DateSerial([DATA_END_DATE_year],[DATA_END_DATE_month],
[DATA_END_DATE_day]) AS DATA_END_DATE_date FROM
5F3_HEORG_IL_RF__20000101_0000_V01
SELECT START_DATE, Left([START_DATE],4) AS START_DATE_year, Mid([START_DATE],
5,2) AS START_DATE_month, Mid([START_DATE],11,2) AS START_DATE_day,
DateSerial([START_DATE_year],[START_DATE_month],[START_DATE_day]) AS
START_DATE_date FROM 5F3_HEORG_IL_RF__20000101_0000_V01
SELECT END_DTTM, Left([END_DTTM],4) AS END_DTTM_year, Mid([END_DTTM],5,2) AS
END_DTTM_month, Mid([END_DTTM],11,2) AS END_DTTM_day, DateSerial(
[END_DTTM_year],[END_DTTM_month],[END_DTTM_day]) AS END_DTTM_date FROM
5F3_HEORG_IL_RF__20000101_0000_V01
SELECT CREATE_DTTM, Left([CREATE_DTTM],4) AS CREATE_DTTM_year, Mid(
[CREATE_DTTM],5,2) AS CREATE_DTTM_month, Mid([CREATE_DTTM],11,2) AS
CREATE_DTTM_day, DateSerial([CREATE_DTTM_year],[CREATE_DTTM_month],
[CREATE_DTTM_day]) AS CREATE_DTTM_date FROM
5F3_HEORG_IL_RF__20000101_0000_V01
SELECT MODIF_DATE, Left([MODIF_DATE],4) AS MODIF_DATE_year, Mid([MODIF_DATE],
5,2) AS MODIF_DATE_month, Mid([MODIF_DATE],11,2) AS MODIF_DATE_day,
DateSerial([MODIF_DATE_year],[MODIF_DATE_month],[MODIF_DATE_day]) AS
MODIF_DATE_date FROM 5F3_HEORG_IL_RF__20000101_0000_V01
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200509/1
Nov 13 '05 #1
2 3102
"Annie D via AccessMonster.com" <fo***@AccessMonster.com> wrote in message
news:54***********@AccessMonster.com...
Hi,

Is it possible to use multiple statements in SQL?? (I've never used it
before)
:

I have one query that i'm working with, The statements I want to use are
as
below, they all work individually, but not together, Access help is as
much
use as a chocolate fireguard in this case! any suggestions or
explainations
would be gratefully appreciated:

I think what you're after is a union query but for this to work the fields
in each branch of the query have to match. Search the help for "union
query" for more info.

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #2
"Keith" <ke*********@baeAWAYWITHITsystems.com> wrote in message
news:43**********@glkas0286.greenlnk.net...
"Annie D via AccessMonster.com" <fo***@AccessMonster.com> wrote in message
news:54***********@AccessMonster.com...
Hi,

Is it possible to use multiple statements in SQL?? (I've never used it
before)
:

I have one query that i'm working with, The statements I want to use are
as
below, they all work individually, but not together, Access help is as
much
use as a chocolate fireguard in this case! any suggestions or
explainations
would be gratefully appreciated:

I think what you're after is a union query but for this to work the fields
in each branch of the query have to match. Search the help for "union
query" for more info.

Regards,
Keith.
www.keithwilby.com

As you probably know, union queries are usually used to get rows from
different places and "stack the results on top of each other". E.g. you
have tables tblTeacher and tblPupil and you want a list of all people
regardless of whether they are teacher or pupil

SELECT TeacherName AS PersonName FROM tblTeacher
UNION
SELECT PupilName AS PersonName FROM tblPupil

With the case in question, each separate select query returns all records
from the same table each time, so I'm not sure she wants the records
"stacked on top of each other". Perhaps all fields from all queries is
required but I would have thought that was straight forward. Or perhaps the
question is can Access work like SQL Server where one stored procedure could
have multiple select statements returning multiple recordsets.
Perhaps the OP would like to clarify.


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tim Hastings | last post by:
Hello, I am using MyODBC from VB and I want to submit a batch of insert statements in one call from my App. This is more efficient than making multiple calls from code because of the...
4
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from...
7
by: Glenn Davy | last post by:
Hidely hodley everyone I'd like to run a series of of sql ddl statements against an msde2000 server. Normally I just deploy cmd file that impliments as osql statement, but I'd like to store the...
24
by: sureshjayaram | last post by:
In some functions where i need to return multiple error codes at multiple places, I use multiple return statements. Say for ex. if (Found == 1) { if (val == -1) return error1; } else { if...
6
by: G.Ashok | last post by:
Hi, Does anybody know how Multiple polymorphism can be done in VB.NET or DOT doesn't support it? Is there any third party extensions available like for Java to do this? Regards, ....Ashok...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
2
by: =?Utf-8?B?VGVycnk=?= | last post by:
I have coded multiple select statements in a single stored procedure, and when I execute this procedure on SQL Server Management Express, I correctly get multiple result sets. But, if I try to add...
3
by: Tim | last post by:
Hi Folks, I'm used to a UNLOAD command that allows me to dump to a named flat file the results of any SELECT statement. Hence one can build a single SQL file which contains multiple SQL...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.