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.
| Author |
Topic |
|
imughal
Posting Yak Master
192 Posts |
Posted - 2004-07-12 : 04:02:28
|
| hi,i am working on 2 queries master and child. Maser query generates/show current year months which are gone. for exp current month is july the master query result will show.2004-06-12 2004-05-12 2004-04-12 2004-03-12 2004-02-12 2004-01-12 now i have to displayed a clientid and name registered in particular month. for exp master query 1 rec is2004-06-12 1 abc 2 xyz2004-04-12 3 ghj 4 asd 5 lkjand so on like that how i go abt that i have the master tabel query.set nocount ondeclare @datein datetimeset @datein = getdate()create table #tempnum(num smallint)insert into #tempnum values (1)insert into #tempnum values (2)insert into #tempnum values (3)insert into #tempnum values (4)insert into #tempnum values (5)insert into #tempnum values (6)insert into #tempnum values (7)insert into #tempnum values (8)insert into #tempnum values (9)insert into #tempnum values (10)insert into #tempnum values (11)insert into #tempnum values (12)select dateadd(month,num*-1,@datein)from #tempnumwhere num < datepart(month,@datein)regards,IM |
|
|
Wanderer
Master Smack Fu Yak Hacker
1168 Posts |
Posted - 2004-07-12 : 11:45:23
|
| IM - show us the table structure's.... we need to know where you are fetching ClientId and name fromCiaO*##* *##* *##* *##* Chaos, Disorder and Panic ... my work is done here! |
 |
|
|
|
|
|