PDA

View Full Version : SQL to query multiple tables and generate a mailing list


induslady
10-28-2008, 03:53 AM
Hello,

I want to generate a mailing list of the users in my vBulletin forum database.

I actually need the username, email, usertitle and location of users who joined on a particular date and from a particular location. If I could get the output of the query downloaded to an excel file, that will be cool.

How do I do it? The data I'm looking for is actually in multiple tables. So I need help with SQL queries using "join" of multiple tables.

Any help? Thanks in advance.

Eikinskjaldi
10-28-2008, 04:21 AM
Hello,

I want to generate a mailing list of the users in my vBulletin forum database.

I actually need the username, email, usertitle and location of users who joined on a particular date and from a particular location. If I could get the output of the query downloaded to an excel file, that will be cool.

How do I do it? The data I'm looking for is actually in multiple tables. So I need help with SQL queries using "join" of multiple tables.

Any help? Thanks in advance.


select u.username, u.email, u.usertitle, f.field2
from user u
join userfield f
using (userid)
where f.field2='whatever location it is you are interested in'
and date(from_unixtime(joindate)) = 'whatever date you want in YYYY-MM-DD format (eg 2006-04-04)'