Created
July 13, 2016 23:13
-
-
Save vanessalove/ad2c6b4d4a450d53048b5557189e79bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * from dbo.Deployment d LEFT JOIN dbo.Channel c | |
ON d.[JSON] LIKE '%"ChannelID":"' + c.Id + '"%' | |
WHERE c.Id is null | |
| |
select * from dbo.Deployment d LEFT JOIN dbo.Release r ON d.ReleaseId = r.Id | |
WHERE r.ChannelId IS NULL | |
| |
select * from dbo.Deployment d cross apply ( | |
select top 1 c.Id as ChannelId from project p inner join channel c on p.Id = c.projectId | |
where p.Id = d.ProjectId | |
order by | |
p.Id, | |
case when c.json like '%IsDefault":true%' then 0 else 1 end) as x | |
WHERE x.ChannelId IS NULL | |
| |
select * from dbo.Deployment d cross apply ( | |
select top 1 c.Id as ChannelId from channel c | |
order by | |
case when c.json like '%IsDefault":true%' then 0 else 1 end, | |
c.Id) as x | |
WHERE x.ChannelId IS NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment