MySql Joining two tables
select rest.PNR, res.TRAIN_NUMBER, res.Tr_name, res.AC_I, rest.na,rest.age
     , rest.doj, rest.seat, rest.src, rest.des, rest.class
     , case when rest.class = 'AC I' then res.FIRST_AC
            when rest.class = 'AC II' then res.SEC_AC 
            when rest.class = 'AC III' then res.THIRD_AC 
            when rest.class = 'Sleeper Class' then res.SL_CLASS 
       end as fare
     , case when rest.class = 'AC I' then  res.AC_I 
            when rest.class = 'AC II' then res.AC_II 
            when rest.class = 'AC III' then res.AC_III 
            when rest.class = 'Sleeper Class' then res.SL 
       end as tickets
from res, rest 
where rest.Tr_Num = res.TRAIN_NUMBER 
order by PNR desc limit 4 ;