|
View previous topic :: View next topic
|
| Author |
Message |
rajandhla
Active User
.jpg)
Joined: 18 Oct 2005 Posts: 182 Location: Luton UK
|
|
|
|
hi,
I am trying to do union of two queries, but i am facing syntax problem
please correct the following query
SELECT * FROM
(SELECT ABC,DEF FROM X.TABLE1
WHERE ABC=313742
UNION ALL
SELECT ABC,DEF FROM X.TABLE2
WHERE ABC=825748 AS TEMP1)
TEMP1 ;
Thanks in advance
Regards
JR |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Do not use "Urgent" in a topic title. One way or another most of the topics are "urgent".
Please post some sample data and the result you want when your query executes. |
|
| Back to top |
|
 |
guptae
Moderator

Joined: 14 Oct 2005 Posts: 1209 Location: Bangalore,India
|
|
|
|
Hi There,
Please give
| Code: |
SELECT ABC,DEF FROM X.TABLE1
WHERE ABC=313742
UNION ALL
SELECT ABC,DEF FROM X.TABLE2
WHERE ABC=825748 |
|
|
| Back to top |
|
 |
rajandhla
Active User
.jpg)
Joined: 18 Oct 2005 Posts: 182 Location: Luton UK
|
|
|
|
Thanks Ekta...
Is the query will work when i select quallified rows by doing check(condition) on mulitiple tables
like where x.a=y.a and
y.b=Z.b
Z.c=x.c..etc
on union is it possible.
Please let me know thanks.. |
|
| Back to top |
|
 |
priyesh.agrawal
Senior Member

Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
rajandhla,
| Quote: |
| on union is it possible. |
you dont wanna do that with Union, if indeed you wanna select records for same values for any column you dont need Union.
May be, if you post your specific requirements we can help better. |
|
| Back to top |
|
 |
|
|