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


i have 2 table table1 , table 2 enter image description here

i want 1 table3 structure

enter image description here

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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -