Entries in the ‘MySQL’ Category:

Multiple Inserts with a Subquery

Inserting multiple rows into a table is simple.

INSERT INTO table1 (id) VALUES (1), (2)

But what if you want to use a subquery to replace the explicit query with something more dynamic. This should be possible, however, searching the internet didn’t get me (or my colleagues) any closer to figuring this out. The obvious attempt of [...]

How to Break a MySQL Left Join

Care must be taken when placing conditions on the results of the right-hand table of a LEFT JOIN because it could easily become a normal JOIN since MySQL is using a NULL row for every column in the right-hand table when no records exist.

addthis_url = ‘http%3A%2F%2Fcodespatter.com%2F2008%2F02%2F19%2Fhow-to-break-a-mysql-left-join%2F’;
addthis_title = [...]

MySQL Fun

Trying to find a way to update a bunch of records in the request table by changing request_taken_time to a value in another table. The problem is, there are multiple records in the history table so there will be duplicate queries and it may not get the most recent time which is what is wanted. [...]