locked
SQL query doubt RRS feed

  • Question

  • User-1216534573 posted

    Hi,

    I need to find the result same experience with different level using SQL

    Emp.No. Emp.Name Exp Level Salary
    1 A 10 9 15
    2 B 10 10 10
    3 C 9 10 20
    4 D 11 11 15
    5 E 9 11 20
    6 F 12 8 16

    With Regards,

    Magesh

    Friday, March 13, 2020 8:23 AM

All replies

  • User2041008840 posted

    what do you want to acheive please ellaborate ? 

    Friday, March 13, 2020 8:59 AM
  • User-1216534573 posted

    I need same experience with different level

    For e.g Emp.No.1 and Emp.No.2 has same experience  but different level

    Friday, March 13, 2020 9:10 AM
  • User1535942433 posted

    Hi Magesh.L,

    Accroding to your description,I don't understand your reuqirment clearly.

    What do you want to output?Could you post the output sample about your requirment.

    Since you don't post more details about samples, I create a demo to group by Exp and use having count the level >1.

    More details, you could refer to below codes:

    select Emp.ENo,Emp.EName,Emp.EExp,Emp.ELevel,Emp.ESalary from Emp inner join(select EExp from Emp group by EExp HAVING COUNT(distinct ELevel) > 1) dup
        ON  dup.EExp = Emp.EExp
    

    Result:

    Best regards,

    Yijing Sun

    Monday, March 16, 2020 7:05 AM