SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast Rami Yacoub's Avatar
    Join Date
    Oct 2004
    Location
    jordan
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i wana make multible max in the table?

    hi all,
    i feeling so bad, i wana make a query and idon't know what to do, hope that any body from this wanderful site, can help me,
    my table is
    id, views, nu_of_rank, score,replies

    i wana make query that fetch
    the id of
    max nu_of_rank then max score, then max views then max replies

    iam not a pro. in data base and i sepend lot of time try to make it, but nothing happend with me, so plz any body can help poor rami :'(

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,262
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Code:
         select id, 'max nu_of_rank' as what 
    from yourtable where nu_of_rank
           = (select max(nu_of_rank) from yourtable)
    union all  
         select id, 'max score' as what 
    from yourtable where score
           = (select max(score) from yourtable)
    union all  
         select id, 'max views' as what 
    from yourtable where views
           = (select max(views) from yourtable)
    union all  
         select id, 'max replies' as what 
    from yourtable where replies
           = (select max(replies) from yourtable)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast Rami Yacoub's Avatar
    Join Date
    Oct 2004
    Location
    jordan
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    thanks

    thank u for help


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •