Page 1 of 1

SQL query help

Posted: Mon Apr 10, 2006 3:53 pm
by anthony88guy
Each time you login a table is populated with the following: userid, time, ip, sid. Now I want to show the last time the person logged in. So my query will search my table for that person’s userid with LIMIT 2, now how to I grab the second row found? I looked on php.net and didn’t see any mysql functions that fit my criteria.

I’m also trying to rank the user. I query'd the table and searched credits DESC, now how do I find the users row thus showing his/her rank?

Thanks.

Posted: Mon Apr 10, 2006 4:18 pm
by hawleyjr

Code: Select all

select * from my_table where user_id = 2 order by fld_time desc limit 1,1