Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
alangustavo
Contributor
Contributor

LOAD field comparing two diferent table

Good moring!
I need to compare two fields in diferent table to put the rigth value in my destination table.
LOAD
my_id,
my_catalog_number
FROM
MY.qvd

LOAD 
vendor_catalog_number1,
vendor_catalog_number2,
price
FROM
VENDOR.qvd

I need store a new table with price with:
my_id, price
And my_catalog_number:
if(my_catalog_number=vendor_catalog_number1) use vendor_catalog_number1
if(my_catalog_number=vendor_catalog_number1) use vendor_catalog_number2
if( my_catalog_number!=catalog_number1 or catalog_number2= 'not_in_vendor_catalog')
I also need to know which products I need to register because they exist in the vendor list and do not exist in my system.

Sample:
MY.QVD
(id, my_catalog_number)
1, ABC
2, 123456
3, GHI

VENDOR.QVD (vendor_catalog_number1, vendor_catalog_numer2, price)
ABC, 999999, 12.00
XYZ,123456, 10.00
JKL,888888, 20.00

I need a table with (id, catalog_number,price,status)
1, ABC,12.00,'IN PRICE LIST'
2,123456,10.'IN PRICE LIST'
3,GHI,'NOT IN PRICE LIST'
,JKL,'NOT IN MY LIST'

I dont have idea to solve it. 
Thanks

Alan

Labels (2)
0 Replies