Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
I have 2 tables one is Headers Table and Data Table.
Like
Table1:
CategoryID
CategoryName
Product
Cost
Table2:
100, Nokia, N70, 12000
101, Samsung, Sam1, 10500
102, LG, LG1, 2500
103, Apple, Apple1, 25000
How to map these tables??
My Output should be like..
CategoryID, CategoryName, Product, Cost
100, Nokia, N70, 12000
101, Samsung, Sam1, 10500
102, LG, LG1, 2500
103, Apple, Apple1, 25000
Thanks in Advance...
I assume you are loading from a text file, otherwise you would get the headers from the database field names:
Data:
LOAD *
FROM mysource.csv
(txt, no labels, delimiter is ',');
MapNames:
Mapping LOAD
'@' & RowNo() As Field,
HeaderName
;
LOAD @1 As HeaderName
FROM headerlnames.txt
(txt, no labels, delimiter is ',');
Rename Fields using MapNames;
Adapt the loads to your specific environment
Please use a more descriptive title for your questions than "Need help". It will help everyone to better spot if it is a request they want to read. If you haven't already looked at the guidelines on how to post on this forum please have a look or please review the good advice you find there.
kind regards
Petter Skjolden
Thanks for Advise .....
HI Jonathan,
If i am use 2 flat files, its working fine, but here
Headers coming from Flat file(CSV)
Data coming from XL file..
Flat file taking like(@1, @2.... so on)
If we have flat files..
Mapping LOAD
'@' & RowNo() As Field,
HeaderName
Suppose if i have Excel file like(A, B, C...)
I am using Chr(65) instead of '@'
But how to increase the value for ASCII code....
PFA..
MapNames:
Mapping LOAD
Chr(Ord('A') + RowNo() - 1) As Field,
HeaderName
;
LOAD @1 As HeaderName
FROM headerlnames.txt
(txt, no labels, delimiter is ',');