Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

HOW TO JOIN 2 DIFFERENT MYSQL TABLES WITH A SQL TABLE Expand / Collapse
Author
Message
Posted Monday, May 13, 2013 1:19 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 20, 2013 8:36 AM
Points: 8, Visits: 68
I have the following query, I have 3 tables
in the first tabel1 (tester.f_artclient) there are 3 colums : name, sellingprice, categorie (sql table)
in the second tabel (tabel2) (mysql) I have the following colums :model, product
in the third tabel (Tabel3) (mysql) I have the following colums: product, price and custumer_group

finally what i want is that the sellingprice from tabel1 comes into price from table 3

I get an error in 'from' on line 5



update tabel3

set dt.price = tabel1.ac_prixVen
from openquery (mysqlapp, 'select * from product_special') as tabel3
inner join (from openquery(mysqlapp,'select * from product') as tabel2
inner join
tester.f_artclient as tabel1
on tabel2.model = tabel1.name collate
database_default where c.ac_categorie = '1'
and tabel2.price <>tabel1.sellingprice) as dt on
tabel3.product = dt.product
collate database_default
where tabel3.customer_group = '1'
and tabel3.price<> tabel1.ac_prixVen

can somebody help we what I am doing wrong

Post #1452289
Posted Monday, May 13, 2013 6:20 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 6:08 PM
Points: 5,401, Visits: 7,514
What's the error, and can you describe the linked server you're calling mysqlapp?


- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Post #1452372
Posted Tuesday, May 14, 2013 2:27 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 20, 2013 8:36 AM
Points: 8, Visits: 68
I found it, now it works,

update tabel3

set tabel3.price = dt.ac_prixVen
from openquery (mysqlapp, 'select * from product_special') as tabel3
inner join (select Ar_ref, Ac_prixVen, AC_categorie,product_id, price
from openquery (mysqlapp, 'select * from product') as tabel2 inner join
tractov15.dbo.f_artclient as tabel1
on tabel2.model = tabel1.ar_ref where tabel1.ac_categorie = '1'
) as dt on
tabel3.product_id = dt.product_id
where tabel3.customer_group_id = '1'
and tabel3.price<> dt.ac_prixVen

the mysqlapp is a linked server for mysql, and at this point my prices de prices in mysql are updated by the prices of sql
thanks

Post #1452425
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse