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 |
|
missMac
Posting Yak Master
124 Posts |
Posted - 2008-11-25 : 06:16:12
|
Hello,am runing this query, but gives me back 253 results. Please helpSELECT ut.[username],ut.First_Name,left(uc.credits,len(uc.credits)-2),left((uc.credits*5),len(uc.credits)-2) FROM [users]as ut INNER JOIN credits uc ON ut.username= 'sally' |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-25 : 06:19:42
|
With what?More records? Fewer records? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
missMac
Posting Yak Master
124 Posts |
Posted - 2008-11-25 : 06:26:17
|
| No, just one record.I have two tables credits and users. Both have usersname, and I want to get the username and credits from an column that suspension is 1 |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-11-25 : 06:44:03
|
quote: Originally posted by missMac No, just one record.I have two tables credits and users. Both have usersname, and I want to get the username and credits from an column that suspension is 1
You haven'tt specified a join condition between the 2 tables. Basis what you've mentioned, you should have a join condition like SELECT ut.[username],ut.First_Name,left(uc.credits,len(uc.credits)-2),left((uc.credits*5),len(uc.credits)-2) FROM [users]as ut INNER JOIN credits uc on ut.username=uc.usernamewhere ut.username= 'sally' |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-25 : 06:44:23
|
[code]SELECT ut.[username], ut.First_Name, left(uc.credits, len(uc.credits) - 2), left(uc.credits * 5, len(uc.credits) - 2)FROM [users] as utINNER JOIN credits AS uc ON ut.username = uc.usernameWHERE ut.username = 'sally'[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-25 : 06:44:47
|
| post your table sample data and explain what you want as in format belowhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
|
|
|
|
|