sql - Understanding what the query is and does? -
this going strange request, can explain in plain english query below doing <>0 bit.
select s.[silks_skey], mc.[majorcolour_skey], mc.[majorcolour] [dbo].[silks] s inner join [dbo].[subcolour] sc on charindex(sc.[subcolour],s.[silksname]) <> 0 inner join [dbo].[majorcolour] mc on sc.[majorcolour] = mc.[majorcolour] thanks
w
the charindex(expressiontofind, expressiontosearch) function searches occurance of string in string. if string not found, returns 0, otherwise returns position of first string in second.
inner join [dbo].[subcolour] sc on charindex(sc.[subcolour],s.[silksname]) <> 0 so join looks subcolours contained in silk's name. example, if silk called "high-quality blue , green silk", join in blue , green subcolours.
Comments
Post a Comment