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 |
vipinjha
Starting Member
21 Posts |
Posted - 2012-01-25 : 02:07:22
|
Dear All ,I want to find the name of employee having same name in organizationwith their full name,address in sql 2008name in emp table and details in add tableor i want to find details of employee having same surnameplesae do the needfulThankx in advanceVipin jha |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-25 : 03:30:57
|
Please give table structure (create statement)sample data (insert statement)wanted result. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
vipinjha
Starting Member
21 Posts |
Posted - 2012-01-25 : 04:08:37
|
Accounts table column :-ACCOUNTS.PREFERREDPHONE,ACCOUNTS.PREFERREDPHONETYPE ,ACCOUNTS.ACCOUNTID,ACCOUNTS.PREFERREDNAME,ACCOUNTS.NAME want to join with CMG on CMG.CUST_ID= ACCOUNTS.ORGKEY basisI want to retrive only those records where having same ACCOUNTS.PREFERREDPHONE for multiple users.i am using thgis query which is not giving proper recordSELECT ACCOUNTS.PREFERREDPHONE,ACCOUNTS.PREFERREDPHONETYPE ,ACCOUNTS.ACCOUNTID,ACCOUNTS.PREFERREDNAME,ACCOUNTS.NAME FROM ACCOUNTSWHERE (SELECT COUNT(*) FROM ACCOUNTS WHERE CMG.CUST_ID= ACCOUNTS.ORGKEY thankx in advance Vipin jha ) >0 ORDER BY ACCOUNTS.PREFERREDPHONE DESCVipin jha |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-25 : 04:48:35
|
Thank you for partial ignoring my request  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2012-01-25 : 09:13:10
|
something like:select<yourfields>from customertableinner join( select name, count(*) from customertable group by name having count(*) > 1 ) checkcountsoncustomertable.name = checkcounts.name This psuedo code is the best I can do without table structures. |
 |
|
|
|
|
|
|