sql - How to display data in below format -
my table is:
id name add 1 2 b b 3 c c 4 d d
i want displaty as:
id name add id2 name2 add2 1 2 b b 3 c c 4 d d
use query below
select ltable.id,ltable.name,ltable.[add], rtable.id,rtable.name,rtable.[add] ( select row_number()over ( order id)as fldkey,id,name , [add] tablename id % 2 <> 0 ) ltable inner join ( select row_number()over ( order id)as fldkey,id,name , [add] tablename id % 2 = 0 ) rtable on ltable.fldkey = rtable.fldkey
Comments
Post a Comment