Skip to content

How to sync two MySQL tables?

If I have a table (lets call it orders) on one server of mine, named, for example, local. And I have this same table one another server of mine, named, for example, remote. My problem is, what is the best way to sync these two tables? I would like a solution that replaces a registry if the local is different

MySQL INSERT INTO … VALUES and SELECT

Is there a way to insert pre-set values and values I get from a select-query? For example: I have the value of “A string” and the number 5, but I’ve to find the [int] value from a select like this: that gives me that id to put inside table1. How to merge this into one statement? Answer Use a…

mysql change all values in a column

I want to change all values in the tablecolumn “Quellendatum”. When the row-value is 2005-06-20 then it should be replaced with 2012-06-20. When the row-value is NULL or empty, then it should be …

Pivot on Multiple Columns using Tablefunc

Has anyone used tablefunc to pivot on multiple variables as opposed to only using row name? The documentation notes: The “extra” columns are expected to be the same for all rows with the same row_name value. I’m not sure how to do this without combining the columns that I want to pivot on (w…

Using ISNULL when adding NULL to varchar

Whilst experimenting with MSSQL I came across some behaviour I cannot explain. I was looking at what happens to a NULL value when it is added to a varchar, and when I do the following query: I get the result ‘te’. Similarly if I change the word test for any other word I only get the first two lett…