472,811 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

this query fails, why?

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
6 2582
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: josh dismukes | last post by:
//Query the Database $query = "SELECT type FROM map WHERE map_file = " . $_SESSION . " AND col = " . $_SESSION . " AND row = " . $_SESSION; $db_result = @mysql_query($query); $db_cell_type =...
3
by: Philip Yale | last post by:
A colleague of mine has a query which fails to run under SQLAgent batch with the following error: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime...
0
by: Steve | last post by:
Hi, Is there something fundamentally wrong with the following query? SELECT MAX(OrderID) AS Expr1 FROM Orders WHERE (MarketActionCode = 'S') AND (OrderLegCode = 'S') AND (Status = 'F') AND...
3
by: Rich N | last post by:
I want to move several records from one table to a new table. My database is set up so that there's the "regular" database, and the ".be" database. In which do I use the Make Table Query?
2
by: Puneet Murgai | last post by:
I am trying to run an access query which works when I write it directly in the database. However, it fails when an SQL script containing it is run from C++. It doesn't recognize the Iff and Nz...
0
by: Winterminute | last post by:
I am trying to read a list of install programs using WMI with ASP.NET/C#. However, it fails with "Invalid Class". I have confirmed that if I query LOCALHOST then it works fine, but if I query a...
1
by: Alex | last post by:
Hi, I need some help with a query. I use a reference table to lookup some codes. Everything works well if the reference table contains a reference but the query fails if no reference fails...
4
by: Jimmy | last post by:
I have a form with a command button on it that is supposed to open up a report and use a query to populate it. DoCmd.OpenReport "rptMailingList", acViewPreview, "qryMailingListChristmas" ...
0
by: mainframetech | last post by:
We are having a problem with Access 2002 as opposed to Access 2000. A multi-file query was set up under 2000 and tested good. Access is connected through a link to an Oracle 9.1 database.It was...
2
BeemerBiker
by: BeemerBiker | last post by:
I put together a (what I consider) complex query using the Access wizard. It works fine in access but fails when I code it up. I can actually make it work in code by "simplifying" it, but then it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.