SQL Server 2008
Two tables:
Table A has following data:
RowA
RowB
RowC
RowD
Table B has following data:
Row
select A.sectionname, A.Basicprice,A.Brand,A.Description,A.Description,A.Grandtotal,A.GST,A.Gstvalue,A.Hsncode,A.Image,A.Installationcharge,A.Model,B.Age,B.Mark,B.Name,B.class
from(
SELECT Class,row_number() over (order by class) as row_num,Age,Mark,Name
FROM classtable)B
LEFT join
(SELECT sectionname,row_number() over (order by sectionname) as row_num,Basicprice,Brand,Description,Grandtotal,GST,Gstvalue,Hsncode,Image,Installationcharge,Model
FROM testtable)A
on A.row_num=B.row_num
try this:
USE ROW_NUMBER() function in sql server 2008
select A.val,B.val
from(
SELECT val,row_number() over (order by val) as row_num
FROM A)A
join
(SELECT val,row_number() over (order by val) as row_num
FROM B)B
on A.row_num=B.row_num
ORDER BY A.val,B.val