SQL server how to do string comparison with left join -
i have 2 tables: entry table (one nvarchar column called entry) , disease table (one nvarchar column called disease).
i produce table has entry-disease combos entry.entry contained in disease.disease. however, want entries not have disease contained within of them still appear in results table {entry, blank}.
i know should like:
select entry disease entry, disease ...
not sure how write this, in advance
ok, figured out much:
select entry.entry, disease.disease new_table entry, disease charindex(entry, disease) > 0
how include entries have no match?
you can utilize left join in case. show entries , provide null
value column disease.disease
if entry not contained in cell of disease.disease
.
select entry.entry, disease.disease entry left bring together disease on charindex(entry.entry, disease.disease) > 0
sql sql-server
No comments:
Post a Comment