SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 32 of 32
  1. #26
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,017
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    what version of mysql are you on?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  2. #27
    SitePoint Addict Banana Man's Avatar
    Join Date
    Dec 2005
    Posts
    389
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It's v4.1.9

  3. #28
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,017
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    4.1 should run that query

    could you please try it outside of php in mysql directly?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #29
    SitePoint Addict Banana Man's Avatar
    Join Date
    Dec 2005
    Posts
    389
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    4.1 should run that query

    could you please try it outside of php in mysql directly?
    Hey,

    Im ready for bed now (it's 22:30 over here in Ireland
    ) but i'll give it a go tomorrow.

    Cheers

  5. #30
    SitePoint Addict Banana Man's Avatar
    Join Date
    Dec 2005
    Posts
    389
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Right, i just had a bash at it directly in mysql (using phpmyadmin). This is the code i used where i replaced the php variables:

    Code:
    SELECT (points_total_g1) as total_points
         , user_id
         , ( select count(*)+1
               FROM apple_users
              WHERE total_points > t.total_points
           ) as ranking
      FROM apple_users as t
     WHERE user_id = 81
    ORDER 
        BY total_points DESC
    but im still getting the same error:

    #1054 - Unknown column 't.total_points' in 'where clause'

    Could it be that the field type is wrong or something. The points_total_g1 field is an INT

  6. #31
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,017
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    O. M. G.

    i can't believe we both looked at this for so long and didn't see it
    Code:
    SELECT points_total_g1 as total_points
         , user_id
         , ( select count(*)+1
               FROM apple_users
              WHERE points_total_g1
                  > t.points_total_g1
           ) as ranking
      FROM apple_users as t
     WHERE user_id = 81
    ORDER 
        BY total_points DESC
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #32
    SitePoint Addict Banana Man's Avatar
    Join Date
    Dec 2005
    Posts
    389
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    lol, were a right pair!!!!

    I just tried it there and its working fine now. Thanks for all your help with this problem, its been greatly appreciated. If you need any php help (not that i know alot at this point) or just webdesign p.m. me.


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
  •