How to convert a MS SQL Merge Query to work with MySQL DB? [closed]


Problem :

We have an SQL DB with 2 Tables and have an MS SQL MERGE query that works great...but...

We are hoping to move to MySQL (a more portable solution) and can't find solid documentation on how to get our SQL MERGE query converted to MySQL...?

Here's the MS SQL query:

MERGE [UpcomingEvents] Ue
USING [MCList] MC
ON Ue.post_title = MC.post_title
WHEN MATCHED THEN
UPDATE 
SET Ue.sku_crmid = MC.sku_crmid

I know we have to drop the [ ]...but we still can't get it to work...

Any ideas?



Solution :

I don't see the point in using MERGE in the first place since you are only performing UPDATES... there is no INSERT when not matched in the code you provided. If this is truly UPDATE only you could use something like the following (untested)...

UPDATE UpcomingEvents as Ue
   INNER JOIN MCList AS MC ON (Ue.post_title = MC.post_title)
   SET Ue.sku_crmid = MC.sku_crmid

Mysql Tutorials

Mysql Howto..

How to connect Crystal Report and MySQL in VB.NET

MYSQL and Normalisation: How to handle lots of optional fields?

How to create a JDBC MySQL connection pool in Tomcat7 installed on Amazon EC2?

MySql: how to create temp table by using dynamic select statement?

php mysql - how to get the id and the date from the link in the 1st page?

MySQL: how to search for a number that might not be unique

How to load column names, data from a text file into a MySQL table?

How to export this from mySQL using SQL or PHP?

how do I show all enum values from database in Java

How to transform a normalised data set using PHP?

how to create new mysql db (clone current) from within rails app?

How to delete a friendship from a MySQL db using php/pdo and check if it is successful

How to disable image link after database value reaches a certain number

How to make a CASE statement dynamic in a MySQL Statement/Query

how to extract data from excel (apache poi) to put it in mysql table using jsp?

How do I fix this code (due to MySql deprecated)

How to do one big select from table in MySQL?

how to import notepad .txt file in phpmyadmin MySql

How to match multiple field in mySQL

How to get php/ajax to get an integer from mysql

How to make value in ascending order in the mysql?

How to Store Multidimensional Array in Mysql Using PHP

how to store and retrieve array in mysql [closed]

How to compare time from MySQL to the current time in php

How to use data reader in vb.net

How can I determine duplicate entries with MySQL

MySQL: How to select distinct values from a table?

MySQL how to check if selected column is null before woking with him?

How do I update the Table for entering marks of students foreach student Id each mark in php mysql

How do I combine data from two MySQL tables to return a list of users sorted by the count of user entries in one table?