I need to get rows that have the same column value from the following table, I tried it as follows, but it gives me only one row.
select * from employee e group by e.empsalary having count(e.empsalary) > 1
Employee table
Please suggest me a way.
You must accomplish this by attaching the table to yourself:
SELECT a.* FROM employee a JOIN employee b ON a.empsalary = b.empsalary AND a.empid != b.empid
Use an internal join to join your advertised request.
select A.* from employee A inner join ( select empsalary from employee group by empsalary having count(*) > 1 ) B ON A.empsalary = B.empsalary
-
SELECT * FROM employee a WHERE EXISTS ( SELECT 1 FROM employee b WHERE a.empsalary = b.empsalary AND a.empid <> b.empid );
- http://sqlfiddle.com/#!2/d75d9/4
select * from employee where empsalary IN(select empsalary from employee group by empsalary having count(empsalary ) > 1)
This.It 2 , .
: http://sqlfiddle.com/#!2/d75d9/6
Source: https://habr.com/ru/post/1529925/More articles:Tkinter set focus on Entry widget - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1529921/is-it-appropriate-to-use-extension-methods-to-map-one-class-to-another&usg=ALkJrhjo8t_7lb5_vyaCeCqEHUOrzbItAwthe file is “corrupted and cannot be opened” when opening a double-attached file - fileGCC C ++ 11 Condition Variables Waiting for Internal - c ++Resizing images with CGImageCreate to reduce memory usage - iosCan these two jQuery lines give different results? - javascriptНеинициализированное значение было создано распределением кучи: Unordered_map - c++How to distribute a location like Whatsapp? - androidNodemon ignore folder using regex expressions - node.jsWhat is the difference between the three priorities used in the Linux kernel? - linuxAll Articles