dear sir/madam
I have given a table
name, dept, sal, doj
n1, d1, 1000, 1/2/2001
n2, d2, 2000, 2/3/2005
n3, d3, 3000, 3/2/2002
n4, d4, 4000, 4/7/2003
n5, d5, 5000,12/5/2006
n6, d2, 6000,3/2/2005
I have to select dept wise record doj should not be in group by but
all record should be doj > 1/2/200. My main problem is that if I dont
take doj in group by then how can I select record on condition of doj.
Please Help me
Thanks in AdvanceIf you need to filter all rows by the condition doj > 1/2/2001 you can add
this filter to the WHERE clause:
WHERE doj > '20010102'
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||Hi
Can you explain what are you trying to achive better?
create table #t (name char(2),dept char(2),sal int,doj datetime)
go
insert into #t values ('n1','d1',1000,'20010201')
insert into #t values ('n2','d2',2000,'20050302')
insert into #t values ('n3','d3',3000,'20020203')
insert into #t values ('n4','d4',4000,'20030704')
insert into #t values ('n5','d5',5000,'20060512')
insert into #t values ('n6','d6',6000,'20050203')
select * from #t where doj=....
Please post desired result
<vinodkus@.gmail.com> wrote in message
news:25c5cfc8-e9d9-4c05-9538-235ac482adf2@.e23g2000prf.googlegroups.com...
> dear sir/madam
> I have given a table
> name, dept, sal, doj
> n1, d1, 1000, 1/2/2001
> n2, d2, 2000, 2/3/2005
> n3, d3, 3000, 3/2/2002
> n4, d4, 4000, 4/7/2003
> n5, d5, 5000,12/5/2006
> n6, d2, 6000,3/2/2005
> I have to select dept wise record doj should not be in group by but
> all record should be doj > 1/2/200. My main problem is that if I dont
> take doj in group by then how can I select record on condition of doj.
> Please Help me
> Thanks in Advance
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment