i want to find multi same city and same salary record by using temp table
Asked
Active
Viewed 56 times
-1
-
1Please explain more and use http://sqlfiddle.com/ for better responces. – Neeraj Prasad Sharma Feb 22 '16 at 12:39
-
3You have to explain your problem better, isnt clear what are you asking. Please read [**How-to-Ask**](http://stackoverflow.com/help/how-to-ask) And here is a great place to [**START**](http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/) – Juan Carlos Oropeza Feb 22 '16 at 12:44
1 Answers
0
declare @t table
(
City nvarchar(20),
Salary decimal(9, 2)
)
insert into @t
(City, Salary)
values (N'New York', 65000),
(N'London', 68000),
(N'Sydney', 59000),
(N'Sydney', 59000),
(N'Tokyo', 66000)
select *
from @t as t
group by t.City,
t.Salary
having count(1) > 1

Ralph
- 9,284
- 4
- 32
- 42
-
-
http://stackoverflow.com/questions/10025032/what-is-the-meaning-of-the-prefix-n-in-t-sql-statements – Ralph Feb 22 '16 at 13:00
-
This code is working for any MS SQL Server Version since 2008. Do you have an earlier version installed? – Ralph Feb 22 '16 at 13:05
-
yes its working now can you tel me i am also want to displaying one More field without group by – Pallav Jha Feb 22 '16 at 13:16
-
If you have a new question then please post the new question. But before you do so, please read the comments by @juan-carlos-oropeza and Neeraj above. Also, please include an SQLfiddle or at least a sample table with sample data (as I have done for you in my answer)! Thank you. – Ralph Feb 22 '16 at 13:27