Jump to content

[SOLVED] Multiple select advice


JonasE

Recommended Posts

Hello,

 

I currently have two tables:

 

documents with fields:

id

title

 

vartitles with fields:

id

doc_id

vartitle

 

Each record can have one primary title (record.title) and several vartitles (referenced by record_id)

 

Here's my problem: I want to search these two tables for matches to titles. After this, I want to return all the documents matching the the title (i.e. matching vartitle and title fields) regardless of whether match for the title was found in the documents table, or in the vartitles table. I know that I can use UNION ALL to return for instance documents.id and vartitles.record_id fields, but how do I select all records matching either of those? Do i use a subquery of some sort?

 

Thank you,

 

Jonas

Link to comment
https://forums.phpfreaks.com/topic/41349-solved-multiple-select-advice/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.