mercredi 30 septembre 2015

How to get Sql Record with out any reference on given example

I have two table as table1 and table 2 as enter image description here

I want one table3 structure as

enter image description here

I dont have any of the reference between upper two tables.

1.Is it possible in single select statement?

Or

2.Required looping for that.

What I have tried is

    select E.EmpID,E.FName,E.LName,C.CityName,E.Salary,DOJ,
    case
    when E.Salary > 0 and E.Salary < 30001 then 'Trainee'
    when E.Salary > 30001 and E.Salary < 60001 then 'Jr. Developer'
    when E.Salary > 60001 and E.Salary < 150001 then 'Sr. Developer'
    when E.Salary > 150001 and E.Salary < 180001 then 'Project Lead'
    when E.Salary > 180001 and E.Salary < 250001 then 'Project Manager'
    else '' end  as Designation 
    from Emp_Master as E inner join City_Master as C
    on E.CityID = C.CityId 

which I think is totally wrong

Please answer me Providing example

Aucun commentaire:

Enregistrer un commentaire