how to select one table values greater then another table valuse using sql server with on Example
for example Date of reg> Date of joining
Date of reg varchar data type and Date of Joining Datetime data type.
Pls help me soon as possible
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Jan 11, 2012, 1:59 AM
try like this.......
create table #EMPDetails
{
EMPName varchar(max)
}
select t1.* from TableName t1 inner join TableName t2 on t1.ID=t2.ID
where t1.DOR>
select case when t1.DOR> cast(t1.DOJ as varchar(50)) then t1.EMPName else null end into #EMPDetails from TableName
select * from #EMPDetails where EMPName<>null
Note:- You can Add more columns in select clause and in Temp table likewise according to you need.
thanks
pravin.