#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    23
    Rep Power
    0
    I have different tables with product. Every tables is a different category, and has prod_id, name, description, price and already sold(int, how many already sold). I want to make a top 10 most sold products.
    For this is have to make a query from different tables, sort by 'already sold' and limit to 10, but how to do this?
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Just try with following example:

    select t1.prod_id, t2.prod_id, t1.name, t2.description, t2.price,t1.alreadysold,
    t2.alreadysold
    from tblename1 as t1,tblename2 as t2,
    where t1.prod_id = t2.prod_id
    and t1.alreadysold='yes'
    and t2.alreadysold='yes'
    group by t1.alreadysold, t2.alreadysold limit 0,10;


    GOOD LUCK!!


    ------------------
    SR -
    shiju.dreamcenter.net

    [This message has been edited by Shiju Rajan (edited April 25, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    23
    Rep Power
    0
    Sorry, maybe i'm not clear enough. Every product has a unique prod_id. There is only one prod_id "1" in all the tables. That's the problem.

    Any other sugestions?

    Dave

Similar Threads

  1. Stumped with update tables query...
    By stumildren in forum PHP Development
    Replies: 5
    Last Post: December 18th, 2003, 07:16 PM
  2. Replies: 2
    Last Post: September 2nd, 2003, 03:29 PM
  3. One query to delete from multiple tables
    By don_sparko in forum Database Management
    Replies: 4
    Last Post: July 25th, 2003, 03:33 AM
  4. Select query - three tables
    By bikerbabe in forum MySQL Help
    Replies: 6
    Last Post: April 28th, 2003, 07:33 AM
  5. getting a query from different tables
    By dave1904 in forum PHP Development
    Replies: 3
    Last Post: April 25th, 2000, 04:11 PM

IMN logo majestic logo threadwatch logo seochat tools logo