|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi All , I have tried many times am getting syntax error on 'UNION' can anybody tell me ... Code:
INSERT INTO table1 ( Type , num_items , num_letters , total_value ) (select type='1', num_items, num_letters=count(*), total_value=sum(letter_value) from table2 where num_items = 1 group by num_items) UNION ( select type='2', num_items, num_letters=count(*), total_value=sum(letter_value) from table2 where num_items = 2 group by num_items) UNION ( select type='3', num_items, num_letters=count(*), total_value=sum(letter_value) from table2 where num_items = 3 group by num_items) ;
Last edited by Corona688; 07-31-2012 at 10:22 AM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
I don't think 'type=3' makes sense inside a select like that. I think you might be able to do '3 as type'.
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell Script to execute Oracle query taking input from a file to form query | DevendraG | Shell Programming and Scripting | 2 | 11-10-2011 05:56 AM |
| Query a oracle DB when fail put in in the error log | Roadster | Shell Programming and Scripting | 8 | 02-04-2011 06:27 AM |
| Query Oracle tables and return values to shell script that calls the query | balaeswari | Shell Programming and Scripting | 6 | 02-04-2010 08:35 AM |
| error ORA-06512 while running query in script | shivanete | Shell Programming and Scripting | 3 | 12-04-2008 06:45 AM |
| Patch query using shell script error | a1_win | Shell Programming and Scripting | 1 | 10-09-2008 05:51 AM |
|
|