Thursday 15 August 2013

sql server - Not include records from within a select query matching a criteria -


I have a query in SQL Server which is displaying some records that I want. The relationship of the field is as follows:

A client ID can have multiple workloads (workload IDs), but not on the other side (one-to-many). In each workload id it is a unit, in each workload id, it is DWLD (date) which it has been assigned to. Multiple WorkloadID can have the same client ID, DWLD, and unit.

Here is a query:

  Select w.WorkloadID, w.ClientID, w.Unit, w.DWLD WWWD & gt; = @ Start & WWW & lt; Remove from workload as client in w.ClientID = cli.ClientID; @Adadet and W. Deleted & lt; & Gt; 1   

I just do not want to display one of the few records, which is the same clientId and the same unit and the same DWLD.

Thank you!

Try this query when you are not receiving records from the client table, there is no need to be included in it.

  Select w.WorkloadID, w.ClientID, w.Unit, w.DWLD Workload, WWW @ dot and @adett and WWEIdited & lt; & Gt; 1 more not (select * workload WEHRE ClientId = w.clientid and unit = w.unit and dwld = w.dwld and workloaded; between w.workloadid and DWLD @ start and @enddate and isDeleted & lt;> 1 )    

No comments:

Post a Comment