MySql

Code Snippet NameSort by Category CategorySort by Category Submitted BySort by Person   Date

Join rows in same table

MySql 10/11/11
This is an sql method for joining two rows in the same table. I have a table that stores emails in two parts, the name and the domain. The data is stored in the same column, but in subsequent rows. So row 1 is value = 'adam' and row 2 is value = 'hyperspatial.com'

I needed to count up all the ... View Code

Tags

Randomize SQL

MySql 09/02/11
Ordering sql results randomly using the ORDER BY RAND() clause/function can be slow with huge tables. This snippet basically selects the rows before randomization instead of randomizing the whole table every time.

Just add the first snippet after your WHERE clause and any AND's, otherwise it ... View Code

Tags

Update Multiple Tables Using Single MySQL Query

MySql 04/06/11
This snippet allows you to combine two table updates with one trip to the DB in a single query
View Code

Tags , , ,

Add Time Using MySQL Query

MySql 03/07/11
This will update a time field and add time to a field View Code

Tags , ,

Reserved Words

MySql 11/10/10
This is a list of reserved MySql words. You cannot use these terms in your query with the exception of the actual command. View Code

Tags