mardi 31 mars 2015

Search algorithm with tag


Vote count:

0




I have three tables in sql server-



Photos table:

----------------------
| PhotoId | PhotoName|
----------------------
| | |
----------------------

Tags table:

----------------------
| TagId | TagName|
----------------------
| | |
----------------------

Junction table:

----------------------
| PhotoId | TagId |
----------------------
| | |
----------------------


A photo can have multiple tags, and a tag can belong to multiple photos.


Now, for example Eagle has tags Bird, Animal, Wild. I would like to search with tags Domestic, Bird, Animal. I'm using sql statement where TagName='Domestic' OR TagName='Bird' OR TagName='Animal'. The problem is, it produces query result where Eagle comes two times.


But I would like to have Eagle only once. Any idea?



asked 23 secs ago







Search algorithm with tag

Aucun commentaire:

Enregistrer un commentaire