Urgent help for a SQL query

Notsogood

Registered User.
Local time
Today, 16:15
Joined
Jan 21, 2004
Messages
86
I have written 2 SQL queries which I wanted to combine using IF-Then statement, if possible.
the first one:
SELECT NewNumber as [Main_number]
FRom try_SQL
Where Type='A' OR type ='V'

The second one is:
SELECT OldNumber as [Main_number]
FRom try_SQL
Where Type<>'A' AND type <>'V'

I want to output the Main_number as a text file on my D drive.
At the moment I have to to output 2 different text files, then combine them.
can someone please help me?
 
Thanks but I have not a clue how Union query works.Can you give me some pointers please.
 
SELECT Main_Number FROM Query1 UNION SELECT Main_Number FROM Query2

This should give the outputs from both results together.

If originally this data all come from one a table - you should be able to get the data out in one go by adding a field called Main_NUmber to a query and calculating whether it should be equal to OldNumber or NewNumber
 

Users who are viewing this thread

Back
Top Bottom