Understanding what the query is and does?

This is going to be a strange request, can someone explain in plain English what the query below is doing especially the <>0 bit.

Select S.[Silks_Skey], MC.[MajorColour_Skey], MC.[MajorColour]
from [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]




The charindex(expressionToFind, expressionToSearch) function searches for the occurance of a string in another string. If the string is not found, it returns 0, otherwise it returns the position of the first string in the second.

inner join [dbo].[SubColour] SC on CHARINDEX(SC.[SubColour],S.[SilksName]) <> 0

So the join looks for all SubColours that are contained in the silk's name. For example, if the silk was called "high-quality blue and green silk", this would join in the blue and green subcolours.

The silk name contains the sub colour name related to it. Sub colours are related to Major colours. Return silks and their related major colours if the silk name contains the sub colour name.

Need Your Help

Login-Window on anonymous access in sharepoint

sharepoint-2010 login anonymous http-status-code-401

Whenever we deploy our sharepoint website we have pages that show a login-window to anonymous users (and after that a 401 if the user does not login). This login-window disappears once we login fro...

uk date format in mysql

php mysql sql datetime

i'm having trouble getting the date to be imported into mysql from my form.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.