I need to create a SQL query to generate the below output from DB.
I am searching a condition like this
When week_val is 1 then hour_val should come from week_val 2 row.
Otherwise hour_val comes from same row.
You may need subquery with CASE Statment
SELECT CASE WHEN week_val =1 THEN (SELECT TOP 1 hour_val FROM TABLE NAME WHERE week_val <> 1)