Ado Query in Delphi 7 To Converts Joined Columns Into Rows Based on Primary Key

233 views Asked by At

I'm using delphi 7 and ado query to connect to an access database with three tables

Actual Tables have hundreds of columns

All the tables are related by Primary Key, i'm using the following query using ado query to get the three tables in one single row and it works fine :

select
table1.name,table1,amount,
table2.item1,table2.type1,table2.item2,table2.type2,
table3.item3,table3.type3,table3.item4,table3.type4,
from ((table1
inner join table2.id_data = table1.id_data)
inner join table3.id_data = table1.id_data)
order by table1.id_data

but what i want to achieve is to get each of item field (table2.item1, table2.item2, table3.item3, table3.item4) to be split or convert into rows (records), perhaps using cross tab or pivot, unpivot type of query, doing lot of search on the web and i'm still trying to figure out. is there any way to do this kind of query?

0

There are 0 answers