sql server - How to get Sql Record with out any reference on given example -
i have 2 table table1 , table 2
i want 1 table3 structure
i dont have of reference between upper 2 tables.
1.is possible in single select statement?
or
2.required looping that.
what have tried
select e.empid,e.fname,e.lname,c.cityname,e.salary,doj, case when e.salary > 0 , e.salary < 30001 'trainee' when e.salary > 30001 , e.salary < 60001 'jr. developer' when e.salary > 60001 , e.salary < 150001 'sr. developer' when e.salary > 150001 , e.salary < 180001 'project lead' when e.salary > 180001 , e.salary < 250001 'project manager' else '' end designation emp_master e inner join city_master c on e.cityid = c.cityid
which think totally wrong
please answer me providing example
you have cast string 2 varchars in order join want:
select table2.empid, table2 .fname, table2.lname, table2.cityid, table2. doj, table2.salary, table1.designation table2 inner join table1 on table2. salary between cast(left( table1.salary, charindex('>', table1.salary ) - 1) int) , cast(right(table1. salary, len( table1.salary ) - charindex('>' , table1. salary)) int );
Comments
Post a Comment