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 |
|
darkness
Starting Member
3 Posts |
Posted - 2006-11-17 : 11:34:22
|
| Hi, i hope i'm asking this on the right forum.My problem is:I need to select only distinct columns from a table, for this i can use: "select distinct username from table_user" but this is not working each time .... someone told me that i can use "alias" ... what does this means and how can i use alias for geting only distinct usernames from my table???hope that is here someone that can help me ... !10xDavid Palmer SQL Manager |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-11-17 : 11:40:53
|
"select distinct username from table_user" but this is not working each time"What do you mean by not working ? What is the problem ? Any error message ? KH |
 |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-11-17 : 11:41:00
|
| Give an example of a query where it isn't working and no, aliases are not going to help you to get distinct data. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-18 : 04:43:36
|
| >>David Palmer SQL ManagerReally?Sounds that you need to make use of derived table. As said post the problamatic queryMadhivananFailing to plan is Planning to fail |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-11-19 : 06:27:02
|
Somthing like this?Select * From Table_User Tbl1 where UserID = (Select Max(UserID) From Table_User Tbl2 Where Tbl2.UseRName = Tbl1.UserName) Chiraghttp://chirikworld.blogspot.com/ |
 |
|
|
|
|
|