Solved

How to Formulate SQL Query from List in Excel?

Posted on 2014-01-31
2
228 Views
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.

SELECT *
FROM `users`
WHERE `mail` LIKE 'a.d.vent.kx.mm@gmail.com'
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.
0
Comment
Question by:sandshakimi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Expert Comment

by:JimFive
ID: 39824184
Bring the list into a temporary table in mySQL and then query:
SELECT *
FROM Users
INNER JOIN tmpList
ON Users.Mail = tmpList.Mail

Open in new window

0
 
LVL 11

Accepted Solution

by:
John_Vidmar earned 500 total points
ID: 39829399
Use an in-clause:
SELECT	* 
FROM	users
WHERE	mail IN
	(	'email001@whatever.blah'
	,	'email002@whatever.blah'
	...	...
	,	'email100@whatever.blah'
	)

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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