473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Mysql 4.1.0 Nested Sql Statements

I've just noticed this pecularity with mysql 4.1.0 running on windows,
wondered if anyone could explain it / or is it a bug.

I have a table called tokContact, which has a column called id, which
has unique values from 1 up into the thousands with no gaps.

This sql statement :

select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id > 10 and id < 150)

returns rows 1..10, 150..199 (As expected)

The problem is if I try :

select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id < 150)

I get an empty result set (why don't I get 150…199)?

Whilst :

select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id > 150)

works as expected, giving 1..150

Thanks,

Paul
Jul 20 '05 #1
3 1325
"Paul" <pa**********@hotmail.com> wrote in message

Using 4.1.1a-alpha:

create table tokContact (id int(1));
insert into tokContact(id) values (1), (2), (10), (11), (12), (149), (150),
(151), (199), (200), (201);
select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id > 10 and id < 150)

returns rows 1..10, 150..199 (As expected)
Right, I get 1, 2, 10, 150, 151, 199.
The problem is if I try :

select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id < 150)

I get an empty result set (why don't I get 150.199)?
I get 150, 151, 199 which is what you expect.

Whilst :

select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id > 150)

works as expected, giving 1..150


Right, I get 1, 2, 10, 11, 12, 149, 150.
Maybe secret is to upgrade!
Jul 20 '05 #2
Just tried it on 4.1.1alpha (windows version) and it doesnt work.

I guess you are running on Linux?

Thanks,

Paul

"Siemel Naran" <Si*********@REMOVE.att.net> wrote in message news:<QN*********************@bgtnsc04-news.ops.worldnet.att.net>...
"Paul" <pa**********@hotmail.com> wrote in message

Using 4.1.1a-alpha:

create table tokContact (id int(1));
insert into tokContact(id) values (1), (2), (10), (11), (12), (149), (150),
(151), (199), (200), (201);
select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id > 10 and id < 150)

returns rows 1..10, 150..199 (As expected)


Right, I get 1, 2, 10, 150, 151, 199.
The problem is if I try :

select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id < 150)

I get an empty result set (why don't I get 150.199)?


I get 150, 151, 199 which is what you expect.

Whilst :

select id from tokContact where id < 200 and id <> ALL (select id from
tokContact where id > 150)

works as expected, giving 1..150


Right, I get 1, 2, 10, 11, 12, 149, 150.
Maybe secret is to upgrade!

Jul 20 '05 #3
"Paul" <pa**********@hotmail.com> wrote in message
Just tried it on 4.1.1alpha (windows version) and it doesnt work.


I'm using Windows.

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: red85 | last post by:
hello i have mysql 4.1 with win2000 SP3, i know that it is only an alpha and i don't know if someone else has already posted this problem: when i execute this sql UPDATE tableX SET...
0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
0
by: Neil Zanella | last post by:
Hello, I would like to know whether it is possible to return prematurely from the body of a MySQL 5 procedure. It seems MySQL 5 only allows the RETURN keyword in PROCEDURES, so I end up having...
175
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
10
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our...
5
by: strawberry | last post by:
In the function below, I'd like to extend the scope of the $table variable such that, once assigned it would become available to other parts of the function. I thought 'global $table;' would solve...
3
by: tulika dutta | last post by:
after 8 hrs my MySQL connection with JDBC gets time out. It gives the error java.sql.SQLException: No operations allowed after connection closed.Connection was implicitly closed due to underlying...
1
by: RAJ | last post by:
hi there, can anybody suggest me best sites for learning php with nested sql statements. i need sql query for searching from database with lots of options like using AND, OR etc even using...
0
by: Neil Cerutti | last post by:
The docs say: A suite can be one or more semicolon-separated simple statements on the same line as the header, following the header's colon, or it can be one or more indented statements on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.