Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
marcobranco1975
Starting Member
2 Posts |
Posted - 2013-02-08 : 06:59:11
|
Hi.i have two tables:First one: Users with:id int (primary)name varcharand a second user_register with:id_userdate_usage DateTimei need to get the list of users with the last access (not all the access.i made thisselect distinct name, date_usage from usersleft join user_register on id_user = idbut i get a all users with all the access register...i need only one per user with the last loginAny idea?Thank's in advanceMarco |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2013-02-08 : 07:02:46
|
select name, max(date_usage) as date_usage from usersleft join user_register on id_user = idgroup by nameMadhivananFailing to plan is Planning to fail |
|
|
|
|
|