Viewing 15 posts - 1 through 15 (of 36 total)
Can you just add this...
,(select sum(b.sal) from cte b where b.seq_no <= a.seq_no and b.deptno = a.deptno) as "RunningTotalWRTDept"
June 17, 2009 at 8:48 am
I found this link very helpful.
http://www.whiteknighttechnology.com/cs/blogs/brian_knight/archive/2006/03/03/126.aspx
February 25, 2008 at 3:01 pm
I think you need:
- left join
- change the <> to not in
- add or classnumber is null (because there will be no records for non TAs in the ta table)
Select...
January 25, 2008 at 9:09 am
Thanks for the info Jeff. Do you have a better way to do it?
January 22, 2008 at 4:35 pm
create table #temp (ID int, monthTotal int, EndPeriodDate datetime)
insert into #temp
select 1,200, '1/30/08'
union all
select 1, 500, '2/28/08'
union all
select 1, 300, '3/31/08'
union all
select 1, 600, '4/30/08'
union all
select 1, 300, '5/31/08'
union all
select...
January 22, 2008 at 11:41 am
I don't know if you want to use a temp table but this should work
select *
into #temp
from emp
where isDate(fromdate) = 1
select fromdate
from #temp
where cast(fromdate as datetime)>'2/16/2007'
December 17, 2007 at 12:29 pm
Just cast fromdate (in the table) as a datetime like:
select fromdate from emp where cast(fromdate as datetime)>'2/16/2007'
as long as you are sure they are all valid datetimes otherwise the...
December 17, 2007 at 11:53 am
select state + '(' + cast(count(state) as varchar(2)) + ')'
from theTable
group by state
order by count(state) desc, state
August 21, 2007 at 12:57 pm
How about...
select *
from @temp
where v between 'joe' and 'ti'
or v like 'joe%'
or v like 'ti%'
August 8, 2007 at 1:24 pm
Viewing 15 posts - 1 through 15 (of 36 total)