By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,625 Members | 1,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,625 IT Pros & Developers. It's quick & easy.

this query fails, why?

P: n/a
Ok guys, here we go again!

SELECT s.nnet_produkt_storrelse_navn
FROM nnet_produkt_storrelse s, nnet_produkt_varegruppe v,
nnet_storrelse_varegruppe_assoc sv, nnet_produkt p
WHERE s.nnet_produkt_storrelse.id = sv.nnet_produkt_storrelse_id
AND sv.nnet_produkt_varegruppe_id = v.nnet_produkt_varegruppe_id
AND sv.nnet_produkt_varegruppe_id IN (
SELECT nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe
WHERE nnet_produkt_varegruppe_code = 'FLU17'
)
AND p.nnet_produkt_storrelse_id > 1

This produces the following error:

You have an error in your SQL syntax near 'SELECT nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe WHERE nnet_produk' at line 1
I don't see anything wrong with this query, it's standard inner SELECT
stuff! I need help... again!

Phil
----------------------------------------------------------------------------
----
_______________________________________________
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Are you using MySQL 4.1? If not, it's absolutly normal that the query
does not work since MySQL only supports subqueries since 4.1, which is
currently an alpha release.

Phil Powell wrote:
Ok guys, here we go again!

SELECT s.nnet_produkt_storrelse_navn
FROM nnet_produkt_storrelse s, nnet_produkt_varegruppe v,
nnet_storrelse_varegruppe_assoc sv, nnet_produkt p
WHERE s.nnet_produkt_storrelse.id = sv.nnet_produkt_storrelse_id
AND sv.nnet_produkt_varegruppe_id = v.nnet_produkt_varegruppe_id
AND sv.nnet_produkt_varegruppe_id IN (
SELECT nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe
WHERE nnet_produkt_varegruppe_code = 'FLU17'
)
AND p.nnet_produkt_storrelse_id > 1

This produces the following error:

You have an error in your SQL syntax near 'SELECT nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe WHERE nnet_produk' at line 1
I don't see anything wrong with this query, it's standard inner SELECT
stuff! I need help... again!

Phil
----------------------------------------------------------------------------
----
_______________________________________________
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk


Jul 17 '05 #2

P: n/a
In article <cSkbb.3113$sp2.2606@lakeread04>,
"Phil Powell" <so*****@erols.com> wrote:
You have an error in your SQL syntax near 'SELECT nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe WHERE nnet_produk' at line 1
I don't see anything wrong with this query, it's standard inner SELECT
stuff! I need help... again!


If you are using MySQL: you can't use subqueries in MySQL yet. They are
planned for version 4.1, if I remember correctly.

If you are using another RDBMS that does support subqueries, just echo
the complete query and the error will usually be obvious.

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #3

P: n/a
Wow. I can't do subqueries, I can't use foreign key constraints, I can't
even use the now() function for default values in an INSERT statement on a
datetime column field..

I can see I won't be doing much in the way of RDM with mySQL. *sigh* Thanx

Phil

"Louis-Philippe Huberdeau" <lp*********@sympatico.ca> wrote in message
news:8d******************@news20.bellglobal.com...
Are you using MySQL 4.1? If not, it's absolutly normal that the query
does not work since MySQL only supports subqueries since 4.1, which is
currently an alpha release.

Phil Powell wrote:
Ok guys, here we go again!

SELECT s.nnet_produkt_storrelse_navn
FROM nnet_produkt_storrelse s, nnet_produkt_varegruppe v,
nnet_storrelse_varegruppe_assoc sv, nnet_produkt p
WHERE s.nnet_produkt_storrelse.id = sv.nnet_produkt_storrelse_id
AND sv.nnet_produkt_varegruppe_id = v.nnet_produkt_varegruppe_id
AND sv.nnet_produkt_varegruppe_id IN (
SELECT nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe
WHERE nnet_produkt_varegruppe_code = 'FLU17'
)
AND p.nnet_produkt_storrelse_id > 1

This produces the following error:

You have an error in your SQL syntax near 'SELECT nnet_produkt_varegruppe_id FROM nnet_produkt_varegruppe WHERE nnet_produk' at line 1
I don't see anything wrong with this query, it's standard inner SELECT
stuff! I need help... again!

Phil


--------------------------------------------------------------------------

--
----
_______________________________________________
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk

Jul 17 '05 #4

P: n/a
In article <j6ubb.5245$sp2.4830@lakeread04>,
"Phil Powell" <so*****@erols.com> wrote:
Wow. I can't do subqueries, I can't use foreign key constraints, I can't
even use the now() function for default values in an INSERT statement on a
datetime column field..


I'll be the first to admit that MySQL has its limits, but you can use
foreign key constraints if you use the InnoDB table type, and you can
define a field as type 'TIMESTAMP' if you need to automatically enter
the current date/time on INSERT.

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #5

P: n/a
You can't use NOW(), but there is an equivalent somewhere. Just search
the documentation. As for the foreign keys, they are availible if you
use InnoDB instead of the default MyISAM. Once again, a simple search in
the documentation will tell you that it has been availible for a while.

Phil Powell wrote:
Wow. I can't do subqueries, I can't use foreign key constraints, I can't
even use the now() function for default values in an INSERT statement on a
datetime column field..

I can see I won't be doing much in the way of RDM with mySQL. *sigh* Thanx

Phil

"Louis-Philippe Huberdeau" <lp*********@sympatico.ca> wrote in message
news:8d******************@news20.bellglobal.com...
Are you using MySQL 4.1? If not, it's absolutly normal that the query
does not work since MySQL only supports subqueries since 4.1, which is
currently an alpha release.

Phil Powell wrote:
Ok guys, here we go again!

SELECT s.nnet_produkt_storrelse_navn
FROM nnet_produkt_storrelse s, nnet_produkt_varegruppe v,
nnet_storrelse_varegruppe_assoc sv, nnet_produkt p
WHERE s.nnet_produkt_storrelse.id = sv.nnet_produkt_storrelse_id
AND sv.nnet_produkt_varegruppe_id = v.nnet_produkt_varegruppe_id
AND sv.nnet_produkt_varegruppe_id IN (
SELECT nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe
WHERE nnet_produkt_varegruppe_code = 'FLU17'
)
AND p.nnet_produkt_storrelse_id > 1

This produces the following error:

You have an error in your SQL syntax near 'SELECT
nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe WHERE nnet_produk' at line 1
I don't see anything wrong with this query, it's standard inner SELECT
stuff! I need help... again!

Phil


--------------------------------------------------------------------------


--
----
_____________________________________________ __
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk



Jul 17 '05 #6

P: n/a
I know about InnoDB but the version of mySQL running on the remote server
where the client who is paying me to do freelance work for is an older
version that does not allow for InnoDB to be an option for table type.

Phil

"Louis-Philippe Huberdeau" <lp*********@sympatico.ca> wrote in message
news:qk*******************@news20.bellglobal.com.. .
You can't use NOW(), but there is an equivalent somewhere. Just search
the documentation. As for the foreign keys, they are availible if you
use InnoDB instead of the default MyISAM. Once again, a simple search in
the documentation will tell you that it has been availible for a while.

Phil Powell wrote:
Wow. I can't do subqueries, I can't use foreign key constraints, I can't even use the now() function for default values in an INSERT statement on a datetime column field..

I can see I won't be doing much in the way of RDM with mySQL. *sigh* Thanx
Phil

"Louis-Philippe Huberdeau" <lp*********@sympatico.ca> wrote in message
news:8d******************@news20.bellglobal.com...
Are you using MySQL 4.1? If not, it's absolutly normal that the query
does not work since MySQL only supports subqueries since 4.1, which is
currently an alpha release.

Phil Powell wrote:

Ok guys, here we go again!

SELECT s.nnet_produkt_storrelse_navn
FROM nnet_produkt_storrelse s, nnet_produkt_varegruppe v,
nnet_storrelse_varegruppe_assoc sv, nnet_produkt p
WHERE s.nnet_produkt_storrelse.id = sv.nnet_produkt_storrelse_id
AND sv.nnet_produkt_varegruppe_id = v.nnet_produkt_varegruppe_id
AND sv.nnet_produkt_varegruppe_id IN (
SELECT nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe
WHERE nnet_produkt_varegruppe_code = 'FLU17'
)
AND p.nnet_produkt_storrelse_id > 1

This produces the following error:

You have an error in your SQL syntax near 'SELECT


nnet_produkt_varegruppe_id
FROM nnet_produkt_varegruppe WHERE nnet_produk' at line 1
I don't see anything wrong with this query, it's standard inner SELECT
stuff! I need help... again!

Phil

--------------------------------------------------------------------------

--
----
_____________________________________________ __
talk mailing list
ta**@lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk


Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.