#1
  1. Wiking
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    3,608
    Rep Power
    27
    I have two tables, one with info about users, and one with gamestatistics. On one page I do four queries to these two tables and present it in four separate tables (ie table one - names and scored goals, sorted by goals desc; table two - names and played games, sorted by games desc ...).
    I would like to run one query instead and fetch all the data needed, and then sort the array four times in different orders. Can this be done, and if so, how?
    What's the most efficient way to do this, multiple queries or sorting an array?

    /NoXcuz
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    6
    Rep Power
    0
    Use multiple queries, onless u make a database
    connection to an entirely different computer with
    a slow connection then u should use sorting yourself..

    but mysql for example should sort much
    quicker

    ------------------
    Greetings lewi
  4. #3
  5. Wiking
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    3,608
    Rep Power
    27
    OK, I'll probably stick with multiple queries, using MySQLs order by, since the db is on the same computer. It's just that I read something about sorting arrays somewhere and got curious of how to do it.

    Thanx

    /NoXcuz
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    6
    Rep Power
    0
    nice to hear a programmer spirit

    experiment with sorting yourself,
    like quicksort and bubblesort etc
    it's very educational, and will make
    u a better programmer



    ------------------
    Greetings lewi

Similar Threads

  1. formulate SQL queries with multiple inputs
    By chalkrabbitNEU in forum Java Help
    Replies: 2
    Last Post: February 12th, 2004, 12:18 PM
  2. Build HTML tables with multiple mySQL queries
    By SailFan in forum PHP Development
    Replies: 5
    Last Post: January 19th, 2004, 11:25 AM
  3. Summing columns from multiple tables then sorting
    By PeMo in forum PHP Development
    Replies: 9
    Last Post: October 25th, 2003, 11:47 PM
  4. Replies: 8
    Last Post: October 25th, 2003, 09:27 PM
  5. putting multiple queries into one query, can it be done
    By sapien in forum PHP Development
    Replies: 3
    Last Post: September 30th, 2003, 03:03 PM

IMN logo majestic logo threadwatch logo seochat tools logo