How to Formulate SQL Query from List in Excel?

Posted on 2014-01-31
Last Modified: 2014-02-20
I've got a list of 100 email addresses.

Need to query against the User table in MySQL, and return their records.

For single query, it's simple.

FROM `users`
WHERE `mail` LIKE ''
LIMIT 0 , 30

Then I'm printing to PDF for reporting.

How can I expedite this with a hundred emails, than just kick out a single PDF with all hundred records?

My list is in a single column in an Excel file.
Question by:sandshakimi
LVL 15

Expert Comment

ID: 39824184
Bring the list into a temporary table in mySQL and then query:
FROM Users
ON Users.Mail = tmpList.Mail

Open in new window

LVL 11

Accepted Solution

John_Vidmar earned 500 total points
ID: 39829399
Use an in-clause:
FROM	users
	(	'email001@whatever.blah'
	,	'email002@whatever.blah'
	...	...
	,	'email100@whatever.blah'

Open in new window


Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql query 8 48
unable to insert record into a table 2 29
Deleting Rows from an Oracle Database - Performance 19 46
Add different cell to otherwise similiar row 4 38
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question