Solved

error in query ....

Posted on 2002-05-03
6
199 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
[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
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

733 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