Created
September 26, 2024 21:22
-
-
Save dontpaniclabsgists/172f57da75a8ac2f2c74ad6697be61ef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
StringBuilder query = new StringBuilder($";With fullTable as (select b.[Id],[BusinessName], "); | |
// manipulate data | |
query.Append($"CAST(CASE WHEN COUNT(service.BusinessId)>0 THEN 1 ELSE 0 END AS bit) as servicesFlag") | |
query.Append($" from [DB].[Businesses] b "); | |
// add data to table that is needed for line 2 to execute properly | |
query.Append($"LEFT JOIN [DB].Services service ON service.BusinessId = b.Id "); | |
Data = db.Businesses.FromSqlRaw(query.ToString()).ToArray(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment