sql - MySQL results from keywords -
I am trying to create a simple search function in MySQL where a user can enter images by entering one or more predefined keywords Can filter. But whenever I add more than one keyword, I'm unable to get the right output. Here is a simplified version of database structure:
Table: Images-id (PK) - Title - Link table: Keyword - ID (PK) - Keyword table: Image_keywords - image_id (FK) - keyword_id (FK)
Example of data:
Image: 1. Image 1 headline http://test1.com 2. Image 2 headline http://test2.com 3. Image 3 Title http://test3.com Keywords: 1. Photography 2. Landscape 3. Skyline image_keywords: 1. 1. 2. 2. 2. 1. 2. 2. 3.
So what should I be able to do image_keywords For all images, Both Photography and Landscape are listed as a keyword and listed them. But can there be an unlimited amount of unlimited keywords with an image in Thermo?
I think this might be what you want:
Select I.id, from within i.title, include inside the interior image_keyword_keyword IK at iid = ik.image_id on the iRecker keyword keywords ik.keyword_id = k.id where k.keyword (' Photography ',' Landscape ') Group by iid, i.title calculation (specific k.id) = 2
Comments
Post a Comment