This topic is locked

Search for master record based on detail data

2/15/2016 3:08:25 PM
PHPRunner General questions
J
jaffleck author

What's the recommended approach for, in a master-detail relationship, searching for master records based on data in the detail records? The SQL is easy, but how can this be accomplished in the GUI?

J
jaffleck author 2/16/2016

Maybe I need to word this differently.....
My application is an image-storing database. The images are mostly old family photographs, some over 100 years old. If the photo has people in it, we record the people in a linking detail table. We also store keywords associated with the image to facilitate searching.
So I have an image table, a keywords table, and a people table (among others). Then I have linking tables to associate the people with the image, and another linking table to associate the keywords with the image:
images (image_id)

people (people_id)

keywords (keyword_id)
lk_image_people (image_id, people_id)

lk_image_keywords (image_id, keyword_id)
My question is how to I include on the image search page, the ability to search based on keyword and/or people? Do I have to include all the associated keywords and people in the images sql to make them appear on the image search window? Or is there a way to build a custom search window that will search for detail record data?
I do not see a "standard" way in phprunner to search for master records using data recorded in the detail records. I have to believe there is a way to do this. Am I just missing it completely?
Thanks.



What's the recommended approach for, in a master-detail relationship, searching for master records based on data in the detail records? The SQL is easy, but how can this be accomplished in the GUI?

J
jaffleck author 2/22/2016

I figured out how to do this. I needed to concatenate the detail data into one column when retrieving the master records. Then you can add the detail data to the search panel and search using "contains".



What's the recommended approach for, in a master-detail relationship, searching for master records based on data in the detail records? The SQL is easy, but how can this be accomplished in the GUI?