hi , your efforts to spread knowledge of sql is appreciated, i would request , please add some more zoom in your's videos as values are not visible in sql studio even in full screen mode thank you so much..
for first_problem with cte as( select *,row_number() over(partition by pairs order by id desc) from( select * ,ntile(3) over(order by id asc) as pairs from table2) as a ) select row_number() over() as id,name from cte; 2nd select name,amount,case when name='n1-online' then 's1' else case when name='n2-online' then 's2' else state end end as state from( select a.*,coalesce(b.state,0)as state from table1a as a left join table1b as b on a.name=b.name) as a;
Hi, I'm solved it in little bit different approach select case when id=(select COUNT(1) from seats_tbl) then id when id%2=0 then id-1 else id+1 end id, name from table order by id;
More such concepts - th-cam.com/play/PLbTF1OfX62c3RQ_ZFfyNBWVPdz_OWTMLG.html
hi , your efforts to spread knowledge of sql is appreciated, i would request , please add some more zoom in your's videos as values are not visible in sql studio even in full screen mode
thank you so much..
ok
for first_problem
with cte as(
select *,row_number() over(partition by pairs order by id desc) from(
select * ,ntile(3) over(order by id asc) as pairs from table2) as a
)
select row_number() over() as id,name from cte;
2nd
select name,amount,case when name='n1-online' then 's1' else case when name='n2-online' then 's2' else state end end as state from(
select a.*,coalesce(b.state,0)as state from table1a as a left join table1b as b on a.name=b.name) as a;
What if we join the tables with a condition as
a1. Seatid < a2.Seatid ?
Hi, I'm solved it in little bit different approach
select
case when id=(select COUNT(1) from seats_tbl) then id
when id%2=0 then id-1
else id+1 end id, name
from table
order by id;
I have an alternative solution
Select a.*,b.state
from table1 join table2
on left(a.Name,2)=b.Name
Please let me know if this is correct
Finished watching
when will you do videos on portfolio
In process