Link to home
Start Free TrialLog in
Avatar of parpaa
parpaa

asked on

Correct my query

Dear Experts,

I have discomfort with my select query ( pls find it below) I know it is wrong..
I highly appreciate if you could correct it.. thanks in advance
select account_no, case 
when [del_no]=0 to 8 then ( select [days_0_8] from table2)
when [del_no]=9 to 15 then ( select [days_9_15] from table2)

end as 'del'
into table3 from table1

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ambidextrous
ambidextrous

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think we'll need a little more info about the relation between table1 and table2, because if you select all rows of column [days_0_8] every time table1.[del_no] is between 0 to 8, you'll end up with lots of duplication.

Maybe an example of data going in would be helpful and the outcome you'd expect.
Avatar of parpaa
parpaa

ASKER

thnks for soln .. It resolved.