• 0

MySql check if (list of items or query) is subset of another query


Question

Something like this,

WHERE (/* LIST OF STUFF PASSED IN */) ARE IN (/* QUERY */)

Well actually one will be a list of things I pass in.

 

EDIT: Apparently you cannot union of list of params eg UNION ('a', 'b', 'c')

EDIT 2: Apparently a comma separated list of stuff is not the same as a query of one column :|

Edited by _Alexander
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Something like this,

WHERE (/* QUERY 1 */) ARE IN (/* QUERY 2 */)

Well actually one will be a list of things I pass in.

 

EDIT: Apparently you cannot union of list of params eg UNION ('a', 'b', 'c')

If you save each query as a view and then do a union, you should be able to do what you are trying.

Link to comment
Share on other sites

  • 0

Actually the outer query is to get an article id

WHERE (list of tags passed in as parameters) are in (query to get all tags on that specific article)

 

I think I can do it with count but it is visually messy.

Link to comment
Share on other sites

This topic is now closed to further replies.