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
How to select one table values greater then another table valuse using sql server with on Example
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Pravin MoreRank #1,419 · 1.2K reputationPosted Jan 10, 2012, 8:59 PM EST
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.