Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SQLite query to extract users from Spiceworks' DB for tickets created in the past 2 years and get it into the format required by FreshDesk for contact import via CSV
select distinct u.email as email,
u.first_name || ' ' || u.last_name as name,
u.title as job_title,
u.cell_phone as mobile,
u.office_phone as phone,
u.location as time_zone,
'en' as language
from users as u
inner join tickets as t on u.id = t.created_by
where (u.disabled is null) and ((u.first_name is not null) and (u.last_name is not null))
and (t.created_at > date('now','-2 years'))
order by u.last_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment