13aaka
Last Updated: February 25, 2016
·
720
· dubrod

SELECT Distinct Year from timestamp mysql

This could be year, month, day, just change the format

zap::select('DISTINCT DATE_FORMAT(timestamp, "%Y") AS "Year" FROM leads');

gotta use zap - http://www.shayanderson.com/projects/zap.htm

RETURN Results from Range

//range is 2013-08

$rangeQuery = $range.'%';

zap::select('* FROM leads WHERE timestamp LIKE {@1}', $rangeQuery);