diff options
Diffstat (limited to 'software/sql.page')
-rw-r--r-- | software/sql.page | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/software/sql.page b/software/sql.page index 5b1a72f..791fd56 100644 --- a/software/sql.page +++ b/software/sql.page @@ -1,9 +1,18 @@ -### SQL +# SQL -# MySQL-specific Tricks +### MySQL-specific Tricks To output in tab-delimited format, do something like: mysql -u root -p -B < some_command.sql > output.tab +### UPDATE with JOIN + +To do an update based on a join:: + + UPDATE tableOne t1 INNER JOIN tableTwo t2 ON t1.fk_two = t2.id SET t1.has_two = 1 WHERE t2.is_good = 1; + +### JOINs + +Useful visual summary: http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins |