Viewing 15 posts - 736 through 750 (of 1,114 total)
Kent,
select
Code,
( select top 1 status
from @emp b
where a.Code = b.Code
order by MID
...
May 5, 2008 at 7:42 am
I am using sql2000.
Can you give me the full query ?
May 5, 2008 at 2:56 am
I don't want to use any tables ( including spt_values or Tally table). How to acheive it ?
May 5, 2008 at 2:39 am
Karthik, if you want to know how it works, I have an article coming out on May 7th (just 4 more days... :hehe called "The "Numbers" or "Tally" Table: What...
May 5, 2008 at 1:15 am
Ok.
Basically, what i want to display is
I want to display the count which is having '0' records in Dept table.
so i have written the query like
select A,Eno,Datepart(Month,JoinDate),Datepart(Year,JoinDate),count(*)
from Emp1 A,Dept...
May 2, 2008 at 5:39 am
Sorry, i posted wrong query !
Query:
Update Emp
set CounterPart = count(*)
from Emp1 A,Dept B
where A.DeptNo = b.DeptNo
AND A.Eno = '101'
GROUP BY A.Eno,Datepart(Month,JoinDate),Datepart(Year,JoinDate)
May 2, 2008 at 5:21 am
I have modified your query little
select PRID, min(Year * 100 + Month)/100 as Year,
min(Year * 100 + Month)%100 as Month,
From #t1 group by PRID
It is working perfectly.
April 30, 2008 at 8:31 am
ygulas,
i have tried out the above method.
but it failed.
April 30, 2008 at 8:28 am
Ryan,
How the minimum Month value is added exactly with year ? Kindly explain me.
If i execute like
Select PRID,Min(Year),Min(Month)
from #t1
group by PRID
it gives us the wrong output.
AAA 2002 1 -- HERE...
April 30, 2008 at 8:25 am
Ryan,
Wow!
select PRID, min(Year * 100 + Month) as YearAndMonth from #t1 group by PRID
Can you explain me the above one ? It is different.
April 30, 2008 at 8:20 am
Jeff,
Really Great!
(No character based date conversions) + (No concatenation) = Very high speed short code.
You taught me a new concept.
Thanks a lot for your prompt reply with good explanations...
April 30, 2008 at 5:40 am
Viewing 15 posts - 736 through 750 (of 1,114 total)