List:General Discussion« Previous MessageNext Message »
From:Rafael Ribeiro Date:April 22 2012 8:30pm
Subject:A Simple Query Help
View as plain text  
Dear Friends,

 

I m new on this list, and I m trying to learn more about mysql.

 

After perform a lot of searchs in the Internet, I have no answer to my
question and would like to ask your help.

 

I wanna a perform a query that depends of the result from another (query)
table inside the same database.

 

On this scenario:

 

I have 02 tables:

 

Table 1 => users

Table 2 => sent_emails

 

 

I wanna select ONLY the users that are NOT inside the table SENT_emails

 

Example:

 

$query1 = SELECT * FROM users WHERE accept_email = ‘1’ 

 

The results from query above SHOULD depends of the query Bellow:

 

$query2 = SELECT * FROM sent_emails WHERE email = $email_from_query_above
AND messageID NOT LIKE = ‘XXXXXX’

 

The results of the first query, should display only the users that are NOT
inside the condition of query 2.

 

I read about INNER JOIN LEFT ... but I can´t understand ...

 

Can help me?

 

With Regards,

Rafael Ribeiro

 

 

 

 

 

 


Thread
A Simple Query HelpRafael Ribeiro22 Apr
  • Re: A Simple Query HelpIgor Shevtsov22 Apr