SQL queries I don't want to forget
Submitted by Sean Keesler on Thu, 08/21/2008 - 22:05
To get events
select CONCAT(e.date,"-",l.name), e.date, l.name as location_name, REPLACE(e.notes,'^M',' '), hour(e.time_start) as start_hour, minute(e.time_start) as start_min, hour(e.time_end) as end_hour, minute(e.time_end) as end_min from locations l, events e where e.location_id=l.id order by date, time_start into outfile '/Volumes/Data/tmp/surveys.txt' fields terminated by ',' enclosed by '"';
- Login to post comments
