Hi,
I have a table with columns clientid,name ,statdate ,enddate...
in my project i have two application which are using same table .
In application1 user dont have cleint ID .in application2 user have id which is default.
below is the query to retieve all distinct empid's ,it returns all id's
select distinct EmpID,EmpName,StartDate,EndDate from EmpTimesheet order by EmpID .
If i want to select only distinct EmpID,EmpName,StartDate,EndDate from EmpTimesheet and who dont have clientid =null
CREATE TABLE [dbo].[EmpTimesheet]( [ID] [int] IDENTITY(1,1) NOT NULL, [ClientID] [int] NULL, [EmpID] [int] NOT NULL, [EmpName] [varchar](50) NULL, [StartDate] [datetime] NULL, [EndDate] [datetime] NULL, ) ON [PRIMARY]
clientid id name sd enddate32 6 abc 2014-02-09 00:00:00.000 2014-02-15 00:00:00.000 Thurs 2014-02-13 00:00:00.000
32 6 abc 2014-02-09 00:00:00.000 2014-02-15 00:00:00.000 Fri 2014-02-14 00:00:00.000
NULL 8 test 2014-02-02 00:00:00.000 2014-02-08 00:00:00.000 Sun 2014-02-02 00:00:00.000
NULL 8 test 2014-02-02 00:00:00.000 2014-02-08 00:00:00.000 Mon 2014-02-03 00:00:00.000