Search:
Database

Calculate Date

Last Updated: May 18, 2016 10:25:46 PM
Created: August 15, 2015 12:00:00 AM

Adding and subtracting days in a MySQL select

date_format(from_unixtime(time_stamp), '%m-%d-%Y') as hitdate

Subtract 1 day

date_format(date_sub(from_unixtime(time_stamp), interval 1 day), '%m-%d-%Y') as hitdate

Add 1 day
date_format(date_add(from_unixtime(time_stamp), interval 1 day), '%m-%d-%Y') as hitdate

MySQL Case

Last Updated: August 16, 2015 03:46:45 PM
Created: August 15, 2015 12:00:00 AM

Use case when substituting a value with another value if a condition is met.

# case when '' then '' else '' end

MySQL Cast

Last Updated: August 16, 2015 03:47:09 PM
Created: August 15, 2015 12:00:00 AM

Convert a field type to a different field type.

/var/www/sequoia_dev/support/Processes/npi/make_NPI_db.sql

MySQL Manual