Combine,shuffle and display results from multiple db queries?

Discussion in 'MySQL' started by livingearth, Jun 21, 2006.

  1. #1
    I need to combine the results of two/three MySQL queries into one well shuffled result. Can anyone help?
     
    livingearth, Jun 21, 2006 IP
  2. iconv

    iconv Well-Known Member

    Messages:
    189
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #2
    The solution would depend on the version of the MySQL server you're using. The easiest would probably be to use a union query, if supported by your version, and sort it by what ever column is appropriate. Alternatively, put the result of he queries into a temporary table and use this table to return the combined result.

    Depending on the nature of your result set, it may also be viable to get the result of the queries returned to your client directly (php?) and do the merging/shuffling there.
     
    iconv, Jun 26, 2006 IP