I have a small video site where I want to get related videos on the basis of the most matched tags. What would be the best MSSQL 2005 query to get the related videos?
A LINQ query would be appreciated as well.
Schema:
CREATE TABLE Videos
(VideoID bigint not null ,
Title varchar(100) NULL,
isActive bit NULL )
CREATE TABLE Tags
(TagID bigint not null ,
Tag varchar(100) NULL )
CREATE TABLE VideoTags
(VideoID bigint not null ,
TagID bigint not null )
Each video can have multiple tags. Now I want to get related videos on basis of tags but only those videos which match most tags. The most matched videos should come on top and the less matched should be on the bottom, if no tags matched then it should not return any videos.
Also I want to know that above schema is ok if I have say more than a million videos and 10-20 tags for each video.