Solved

error in query ....

Posted on 2002-05-03
6
194 Views
Last Modified: 2009-12-16
Hi,
I'm using PHP with mySQL and getting an error while executing the following query. this query is running fine in SQL Server but gives an error in mySQL.

qry is ....
SELECT DISTINCT Email FROM sw_users WHERE sw_users.Email NOT IN (SELECT DISTINCT email from tblusage))

and the err is
You have an error in your SQL syntax near 'SELECT DISTINCT email from tblusage))

why is it so? why is it running fine in SQL Server and not in mySQL ???

0
Comment
Question by:m_adil
6 Comments
 
LVL 1

Expert Comment

by:logan69
ID: 6988233
MySQL Doesn't support sub selects.
0
 
LVL 1

Expert Comment

by:logan69
ID: 6988234
You will need to run two queries , one to get the list of emails from tblusage, then echo that into the second query.
0
 
LVL 2

Expert Comment

by:jpoesen
ID: 6988293
indeed, logan69.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Expert Comment

by:peebody
ID: 6988298
This should work:

SELECT DISTINCT sw_users.Email FROM sw_users LEFT JOIN tblusage ON sw_users.Email=tblusage.email WHERE tblusage.email = NULL
0
 

Accepted Solution

by:
peebody earned 50 total points
ID: 6988307
sorry, should be: SELECT DISTINCT sw_users.Email FROM sw_users LEFT JOIN tblusage ON sw_users.Email=tblusage.email WHERE
tblusage.email IS NULL
0
 
LVL 1

Expert Comment

by:Rajko
ID: 6995633
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now