LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-14-2007, 02:09 PM   #1
ravi.xolve
Member
 
Registered: Jul 2006
Posts: 89

Rep: Reputation: 15
Exclamation query not working in Mysql


queries like:

(select customer_name from customer)
intersect
(select customer_name from depositor)

and similarily EXCEPT is not being recognised by mysql and documnetation make no mention as such.
pls help
 
Old 03-14-2007, 02:15 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
mysql is not ansi sql92 compliant, there are some functions that it doesn't support, most notably complex selects... as you've found out.
 
Old 03-14-2007, 02:53 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Can you use something like this instead:
Code:
select CUSTOMER_NAME from CUSTOMER where CUSTOMER_NAME in (select CUSTOMER_NAME from DEPOSITOR)
That should return customers from the customer table that are also depositors.
 
Old 03-14-2007, 03:26 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
mysql does sub queries now does it? didn't think it would do that either...
 
Old 03-14-2007, 07:01 PM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Subqueries are recognized in mysql > 4.21 (if I am not mistaken.) For sure not *every* version does it. Be careful and check the mysql docs.

I think this query should do what you need:

select customer.customer_name, depositor.customer_name from customer inner join depositor where customer.customer_name= depositor.customer_name

jlinkels
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help in Mysql query marco-slack Programming 4 08-06-2006 03:23 PM
help with mysql query: return nth rows in query hawarden Programming 2 07-31-2006 06:36 PM
mySQL query help ezra143 Programming 3 04-25-2005 03:17 PM
MySQL++ Query jimbob8483 Programming 1 12-15-2004 06:47 AM
Mysql Error: Lost Connection to Mysql during query ramnath Programming 5 11-18-2003 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration