@manhnguyenv

Welcome to my blog!

Audiance

October 13, 2017 20:27

Lấy dữ liệu cho Filter

SELECT DISTINCT
dbo.AuditLocationData.AuditId
FROM dbo.AuditLocation
INNER JOIN dbo.AuditLocationData ON dbo.AuditLocation.Id = dbo.AuditLocationData.AuditLocationId
INNER JOIN dbo.Audits ON dbo.AuditLocationData.AuditId = dbo.Audits.Id
INNER JOIN dbo.Project ON dbo.Project.Id = dbo.Audits.ProjectId
WHERE ( dbo.Audits.ProjectId = '140a7c96-d463-400c-94f5-01ef7b84ef2f' )
AND dbo.AuditLocationData.IsDraft = 0
AND ( (dbo.AuditLocationData.Value = '100') )

----------------------------------------------------------------------------------------------------

SELECT DISTINCT dbo.AuditLocationData.AuditId FROM dbo.AuditLocation INNER JOIN dbo.AuditLocationData ON dbo.AuditLocation.Id = dbo.AuditLocationData.AuditLocationId INNER JOIN dbo.Audits ON dbo.AuditLocationData.AuditId = dbo.Audits.Id INNER JOIN dbo.Project ON dbo.Project.Id = dbo.Audits.ProjectId WHERE (dbo.Audits.ProjectId='140a7c96-d463-400c-94f5-01ef7b84ef2f') AND dbo.AuditLocationData.IsDraft=0 AND ((dbo.AuditLocationData.Value='1'))

----------------------------------------------------------------------------------------------------

SELECT DISTINCT dbo.AuditLocationData.AuditId FROM dbo.AuditLocation INNER JOIN dbo.AuditLocationData ON dbo.AuditLocation.Id = dbo.AuditLocationData.AuditLocationId INNER JOIN dbo.Audits ON dbo.AuditLocationData.AuditId = dbo.Audits.Id INNER JOIN dbo.Project ON dbo.Project.Id = dbo.Audits.ProjectId WHERE (dbo.Audits.ProjectId='140a7c96-d463-400c-94f5-01ef7b84ef2f') AND dbo.AuditLocationData.IsDraft=0

----------------------------------------------------------------------------------------------------

SELECT DISTINCT dbo.AuditLocationData.AuditId FROM dbo.AuditLocation INNER JOIN dbo.AuditLocationData ON dbo.AuditLocation.Id = dbo.AuditLocationData.AuditLocationId INNER JOIN dbo.Audits ON dbo.AuditLocationData.AuditId = dbo.Audits.Id INNER JOIN dbo.Project ON dbo.Project.Id = dbo.Audits.ProjectId WHERE (dbo.Audits.ProjectId='140a7c96-d463-400c-94f5-01ef7b84ef2f') AND dbo.AuditLocationData.IsDraft=0

Lấy dữ liệu cho dropdown list

SELECT DISTINCT dbo.AuditLocationData.Value FROM dbo.AuditLocationData
JOIN dbo.AuditLocation ON dbo.AuditLocation.Id=dbo.AuditLocationData.AuditLocationId
JOIN dbo.Audits ON dbo.Audits.Id = dbo.AuditLocationData.AuditId WHERE dbo.AuditLocation.ColumnOrder=0
ORDER BY dbo.AuditLocationData.Value

SELECT DISTINCT dbo.AuditLocationData.Value FROM dbo.AuditLocationData
JOIN dbo.AuditLocation ON dbo.AuditLocation.Id=dbo.AuditLocationData.AuditLocationId
JOIN dbo.Audits ON dbo.Audits.Id = dbo.AuditLocationData.AuditId WHERE dbo.AuditLocation.ColumnOrder=0
AND dbo.Audits.Id IN ('F59B8CBF-E943-467E-9FDA-000E91CCE625','8EA1CFD1-601D-4261-A602-000DEE320CC0')
ORDER BY dbo.AuditLocationData.Value

Categories

Recent posts