Skip to content

Instantly share code, notes, and snippets.

@gmgent
Created March 5, 2012 22:38
Show Gist options
  • Save gmgent/1981662 to your computer and use it in GitHub Desktop.
Save gmgent/1981662 to your computer and use it in GitHub Desktop.
impersonating a split function in MySQL
select sum(amount) total
, ds item_date
, LEFT(ds, 4) item_year
, SUBSTRING_INDEX(ds,'-',-1) item_day
, LEFT(SUBSTRING(ds,INSTR(ds,'-')+1), 2) item_month
, created_at
, td
from temp_ps
group by ds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment