Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 comparing two columns

Author  Topic 

sachingovekar
Posting Yak Master

101 Posts

Posted - 2009-07-16 : 09:55:16
Hi,

I want to pull date for application which were used prior week and current week

create table #temp1
(
name varchar(100),
countprior int,
countcurrent int
)

insert into #temp1 values('abc',12,50)
insert into #temp1 values('abc',18,21)
insert into #temp1 values('abc',19,78)
insert into #temp1 values('abc',22,7)
insert into #temp1 values('abc',10,12)
insert into #temp1 values('abc',11,6)

my output should be
abc 12 50
abc 18 21
abc 19 78
abc 10 12

to look for increased figuress in current week

this query doesn't work

select * from #temp1
where countprior < countcurrent

Regards,
Sachin

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-16 : 10:01:41
Your query gives exact your wanted output!


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-16 : 10:03:29
Why doesn't that query work? It works fine and gives exactly what you are after in your output?!?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-16 : 10:18:23
slow but sure

Edit: SCNR

No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

sachingovekar
Posting Yak Master

101 Posts

Posted - 2009-07-16 : 11:10:48
thanks had nulls in my orginal table
Go to Top of Page
   

- Advertisement -