Author |
Topic |
dnpmoris
Starting Member
23 Posts |
Posted - 2006-09-05 : 17:23:44
|
Hi I need help in the beow union query, if any one can modify this query then it would be great help.INSERT INTO yahoo_abQuery names are as follows (I need to merge all the queries below into single table):SELECT_Dnpmoris_yahoo_ab A SELECT_Dnpmorise_yahoo_ab BSELECT_Hmorise_yahoo_ab CSELECT_Jayamorise_yahoo_ab DSELECT_Morisetti_phani_yahoo_ab ESELECT_Morisetti_prasad_yahoo_ab GSELECT_Naveen1305_yahoo_ab HSELECT_Naveen513_yahoo_ab ISELECT_Phani_morisetti_yahoo_ab J;- Naveen |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-09-05 : 21:07:37
|
Use UNION ALLINSERT INTO yahoo_abSelect * from(SELECT_Dnpmoris_yahoo_ab A union allSELECT_Dnpmorise_yahoo_ab B union allSELECT_Hmorise_yahoo_ab C union allSELECT_Jayamorise_yahoo_ab D union allSELECT_Morisetti_phani_yahoo_ab E union allSELECT_Morisetti_prasad_yahoo_ab G union allSELECT_Naveen1305_yahoo_ab H union allSELECT_Naveen513_yahoo_ab I union allSELECT_Phani_morisetti_yahoo_ab J) TMadhivananFailing to plan is Planning to fail |
 |
|
dnpmoris
Starting Member
23 Posts |
Posted - 2006-09-06 : 12:09:36
|
INSERT INTO yahoo_abSelect * from(SELECT_Dnpmoris_yahoo_ab union allSELECT_Dnpmorise_yahoo_ab union allSELECT_Hmorise_yahoo_ab union allSELECT_Jayamorise_yahoo_ab union allSELECT_Morisetti_phani_yahoo_ab union allSELECT_Morisetti_prasad_yahoo_ab union allSELECT_Naveen1305_yahoo_ab union allSELECT_Naveen513_yahoo_ab union allSELECT_Phani_morisetti_yahoo_ab);The above query is not working and saying that join has a problem. So, can anyone help me in modifying this query? |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-09-06 : 12:16:22
|
Did you notice that T is used as alias name?Is SELECT_Dnpmoris_yahoo_ab as string or tablename?MadhivananFailing to plan is Planning to fail |
 |
|
dnpmoris
Starting Member
23 Posts |
Posted - 2006-09-06 : 14:50:21
|
The SELECT_Dnpmoris_yahoo_ab is a "Query name". I noticed that 'T' and removed that in my query but still it is not working. |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-09-06 : 14:57:18
|
It needs the T. Don't remove it.Tara Kizer |
 |
|
dnpmoris
Starting Member
23 Posts |
Posted - 2006-09-06 : 15:05:22
|
It is warning me that, "Syntax error in JOIN Operation" and pointing to Union All. So, ple help me? |
 |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-09-06 : 17:47:52
|
I would split this into 2 queries. Access is a bit picky when it comes to complex statements such as this. Firstly, put all your UNION's in a single query and verify that it's returning the right data. Then create another INSERT (or 'Append' as Access likes to call it) query to insert the new data into your table. Just noticed: you might want to add 'SELECT * FROM ':INSERT INTO yahoo_abSelect * from(SELECT * FROM SELECT_Dnpmoris_yahoo_ab union allSELECT * FROM SELECT_Dnpmorise_yahoo_ab union allSELECT * FROM SELECT_Hmorise_yahoo_ab union allSELECT * FROM SELECT_Jayamorise_yahoo_ab union allSELECT * FROM SELECT_Morisetti_phani_yahoo_ab union allSELECT * FROM SELECT_Morisetti_prasad_yahoo_ab union allSELECT * FROM SELECT_Naveen1305_yahoo_ab union allSELECT * FROM SELECT_Naveen513_yahoo_ab union allSELECT * FROM SELECT_Phani_morisetti_yahoo_ab) T; You could also try it without the 'T' alias. I don't like to disagree with Tara, but I've never had to do this with my Access queries.HTH,Tim |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-09-06 : 17:50:06
|
The T is required for derived tables in T-SQL. I'm not sure about Access.Tara Kizer |
 |
|
dnpmoris
Starting Member
23 Posts |
Posted - 2006-09-06 : 18:56:24
|
THANKS FOR THIS QUERY AND IT WORKED WELL |
 |
|
|