I want to display the employees who have joined in last two
months. (It should be executed randomly means If I execute
the query in March it should display Jan and Feb joined
employees. Same query if i execute in Feb, 2007 it should
display dec, 2006 and jan 2007 joined employees.

Answer Posted / balaji s.t

select convert(varchar(10),
dateadd(dd,-(day(dateadd(mm,1,getdate()))-1), dateadd(mm,-2,getdate())), 120),

convert(varchar(10),dateadd(dd,-(day(getdate())),getdate()),120)

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba

554


in oracle 10g sw after compiling procedure how to pass parameter values ,if we (v_empid out number)how to give empid after successful compilation program.This site exact suitable for 10g with respect to question & answer same format , im trying sql browser & sql command prompt using exec procedure name & respective parameters.

1647


What is scope and visibility in PL/SQL?

602


What are the differences between in and exists clause?

571


Why are sql stored procedures used?

617






What is the use of prepared statement?

541


Is sql low level language?

579


Write a unique difference between a function and a stored procedure.

533


Is grant a ddl statement?

453


Can we create a trigger on view?

491


what is commit? : Sql dba

619


What are the two types of periodical indexes?

507


What does <> sql mean?

542


How do I upgrade sql?

553


Does access use sql?

565