• 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

3 answers to this question

Recommended Posts

  • 0
  On 17/08/2013 at 05:50, _Alexander said:

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.

  • 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.

This topic is now closed to further replies.
  • Posts

  • Recent Achievements

    • One Month Later
      mevinyavin earned a badge
      One Month Later
    • Week One Done
      rozermack875 earned a badge
      Week One Done
    • Week One Done
      oneworldtechnologies earned a badge
      Week One Done
    • Veteran
      matthiew went up a rank
      Veteran
    • Enthusiast
      Motoman26 went up a rank
      Enthusiast
  • Popular Contributors

    1. 1
      +primortal
      684
    2. 2
      ATLien_0
      266
    3. 3
      Michael Scrip
      195
    4. 4
      +FloatingFatMan
      181
    5. 5
      Steven P.
      140
  • Tell a friend

    Love Neowin? Tell a friend!