Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: SQLServer to Sybase conversion, please



In article <[EMAIL PROTECTED]>, Andy K wrote:
> The following SQL runs on SQLServer:
> 
> select col1, sum( col2 ) from (
> select col1, col2 from table1
> union all
> select col1, col2 from table2
> ) as sub
> group by col1
> 
> but I can't get Sybase to recognise this as SQL. 
> 
> How can accomplish the same thing in Sybase ?
> 

See Rob's answer, but this may be your work-around:

select col1, col2 into #table
from table1
insert into #table
select col1, col2 from table2
select col1, sum( col2 ) from #table
group by col1
go
drop table #table
go



-- 
 ___              _
| _ \___ _ _  ___//
|   / -_) ' \/ -_)  
|_|_\___|_||_\___|  



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.