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 |
|
Maachie
Yak Posting Veteran
69 Posts |
Posted - 2007-11-15 : 11:29:57
|
| I want to select all the fields from just one tableThis is what i have and i am having trouble selecting all the fieldsselect * from ace_users where chdata EXISTS (select chdata, count(chserialnum) from ace_users group by chdata having count(chserialnum)> 1)Exists and IN does not work. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-11-15 : 11:39:43
|
| Not really sure what you want - maybeselect * from ace_users where chdata in(select chdatafrom ace_usersgroup by chdatahaving count(*)> 1)==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Maachie
Yak Posting Veteran
69 Posts |
Posted - 2007-11-15 : 13:22:24
|
| I want one user having multiple accounts and it is from one tableEx: empid1 has fob1, fob2 fob3Ex: empid2 has fob1 fob2Ex: Empid3 has fob1 fob2,fob3,fob4I get this from (select chdata, count(chserialnum) from ace_users group by chdata having count(chserialnum)> 1)But I want to display all the other columns as well from the table?I triedselect * from ace_users where chdata IN (select chdata, count(chserialnum) from ace_users group by chdata having count(chserialnum)> 1)When I tried IN it threw me an error, I also tried Exists. It did not work.Hope it is clear now. |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-11-15 : 15:20:12
|
| 'coz when you do IN the SELECT statement returning the result should match what you are IN'ing on. So you are saying chdata IN (...) Your inner SELECT should ONLY return data of type chdata.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
|
|
|