Hi.
Would really appreciate some help with a search angine I'm trying to make for a karaoke music site using ASP.NET and SQL SERVER...
I have a table called Discs which has the following fields:
ID, DiscCode, DiscTitle, DiscType, Theme, Manufacturer
There is also a table called Tracks with the following fields
ID, DiscID, Artist, Title
OK, so imagine a user performs a search for the following...
Artist: Michael Jackson
Title: Thriller
Theme: Pop
Manufacturer: Sunfly
DiscType: cdg
I would use a SQL statement like this....
SELECT D.ID, T.Artist, T.Title, D.Manufacturer, D.DiscTitle
FROM Discs D
INNER JOIN Tracks T
ON T.DiscID = D.ID
WHERE T.Artist LIKE 'Michael JAckson%'
AND T.Title LIKE 'Thriller%'
AND D.Theme = 'Pop'
AND D.Manufacturer = 'Sunfly'
AND DiscType = 'DVD';
That will work fine, but if no results are found I really want to be able to tell the user how many results they would get if any of the filters were removed with a count, like ebay does...
Sorry, No results were found but we did find some similar results.
Different Artists (13)
Different Manufacturers (4)
Different Themes (2)
The client has 2 stipulations for us. A) he wants to use a "startswith" match on each item, hence the wildcard at the end of each LIKE , and B) he doesn't want to use MSSQL Full TEXT searching.
I don't want to have to do lots of searches as this will really slow things down and instinctively it feels like there should be some way of doing this by using crouping and counts.
Any help would really be appreciated.
Jon