this query fails, why? – PHP

  php

Q(Question):

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

A(Answer):

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

A(Answer):

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" = @.

A(Answer):

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

A(Answer):

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" = @.

A(Answer):

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

A(Answer):

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

LEAVE A COMMENT