How to get a list of all From: fields in my database, saved to text file?

26 views
Skip to first unread message

Michael Levin

unread,
Oct 29, 2017, 12:07:42 PM10/29/17
to Sequel Pro
I have a MySQL database which contains a lot of email. I can access it from Sequel Pro but I don't know how to use SQL at all. How hard is it to ask Sequel Pro to take every email's From field and save it as a separate line in a text file?

Larry Spencer

unread,
Oct 29, 2017, 8:46:52 PM10/29/17
to Sequel Pro


On Sunday, October 29, 2017 at 11:07:42 AM UTC-5, Michael Levin wrote:
I have a MySQL database which contains a lot of email. I can access it from Sequel Pro but I don't know how to use SQL at all. How hard is it to ask Sequel Pro to take every email's From field and save it as a separate line in a text file?

Open your database in Sequel Pro.  Click the Query icon.  Type into the upper pane:

select whatever_field_has_the_from_data_in_it from your_table_name 
      order by date_sent_or_whatever_field_you_want;

...with the appropriate substitutions; select all, then click on Run Selection.

The results will appear in the lower pane. Save them as CSV, which is a text file when opened with a text app.

If you only want to see each sender once no matter how many messages he has sent, use "select distinct(whatever_field...)..."

Michael Levin

unread,
Oct 30, 2017, 5:05:45 AM10/30/17
to Sequel Pro
Thanks!!! that worked great - fantastic.  I don't suppose there's any easy way to ask it to do statistics on the output (how many times each string appeared (as a variant on Distinct)?
Message has been deleted

Larry Spencer

unread,
Oct 30, 2017, 10:58:25 PM10/30/17
to Sequel Pro
select distinct(field_name), count(*) from table_name group by field_name; 

Michael Levin

unread,
Oct 31, 2017, 12:29:19 PM10/31/17
to Sequel Pro
super, thanks! that works great. I also learned that copy/paste of the results into Excel is way cleaner than exporting it into a .CSV file and opening it after.
Reply all
Reply to author
Forward
0 new messages