Use distinct keyword and null or 'xyz' (blank values)
select distinct value as crimecategory, lu.Description from Investigation iv cross apply string_split(iv.crimecategory,',') Left join Lookup lu on value = lu.LookupID where (CrimeCategory != '' OR CrimeCategory != NULL) AND BranchId=30
reference:- https://stackoverflow.com/questions/10912237/sql-select-distinct-rows-and-ignore-row-if-blank
https://stackoverflow.com/questions/30284503/how-to-remove-blank-rows-from-sql-result-set
No comments:
Post a Comment