Re: error in your SQL syntax

2005-01-26 Thread Rhino
You have an awful lot of brackets in the query, many of which don't appear
to be needed. For example, I don't see why you have brackets in this phrase:

AND ((languages.languages_id)=1))

Perhaps removing the unnecessary ones will help the query work better and
more consistently on each machine.

Are the different machines all running the exact same version of MySQL?

Rhino



- Original Message - 
From: Daniel Sousa [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Wednesday, January 26, 2005 6:45 AM
Subject: error in your SQL syntax


I have a problem.

1064 - You have an error in your SQL syntax near '(((specials INNER JOIN
(products_to_categories INNER JOIN categories ON products' at line 2

SELECT DISTINCT specials.specials_id, products_to_categories.products_id,
categories.parent_id, products_description.products_name,
products.products_price, products.products_tax_class_id,
products.products_image, specials.specials_new_products_price,
languages.languages_id FROM languages INNER JOIN (((specials INNER JOIN
(products_to_categories INNER JOIN categories ON
products_to_categories.categories_id = categories.categories_id) ON
specials.products_id = products_to_categories.products_id) INNER JOIN
products ON specials.products_id = products.products_id) INNER JOIN
products_description ON specials.products_id =
products_description.products_id) ON languages.languages_id =
products_description.language_id WHERE (((categories.parent_id)=285) AND
((languages.languages_id)=1))



i run this query in my computer and work, but in the internet server don´t.

If anyone can solve this problem answer me.

Daniel Sousa







No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 21/01/2005



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 21/01/2005


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: error in your SQL syntax

2005-01-26 Thread SGreen
Here is your original query, reformatted merely so that we humans can read 
it better:

SELECT DISTINCT specials.specials_id
, products_to_categories.products_id
, categories.parent_id
, products_description.products_name
, products.products_price
, products.products_tax_class_id
, products.products_image
, specials.specials_new_products_price
, languages.languages_id 
FROM languages 
INNER JOIN 
(
(
(specials INNER JOIN 
(products_to_categories 
INNER JOIN categories 
ON products_to_categories.categories_id = 
categories.categories_id
)ON specials.products_id = 
products_to_categories.products_id
) 
INNER JOIN products 
ON specials.products_id = products.products_id
) 
INNER JOIN products_description 
ON specials.products_id = products_description.products_id
) ON languages.languages_id = products_description.language_id 
WHERE 
(
(
(categories.parent_id)=285
) AND (
(languages.languages_id)=1
)
)

This query design stinks (reeks) of being autogenerated by M$ Access. The 
excessive use of parentheses when they aren't needed and the nested JOINs 
just complicate the query unnecessarily. 

May I suggest a simplification?


SELECT DISTINCT specials.specials_id
, products_to_categories.products_id
, categories.parent_id
, products_description.products_name
, products.products_price
, products.products_tax_class_id
, products.products_image
, specials.specials_new_products_price
, languages.languages_id 
FROM categories
INNER JOIN products_to_categories
ON products_to_categories.categories_id = categories.categories_id 

INNER JOIN products
ON products.products_id = products_to_categories.products_id
INNER JOIN specials
ON specials.products_id = products.products_id
INNER JOIN products_description
ON products.products_id = products_description.products_id
INNER JOIN languages
ON products_description.language_id = languages.languages_id
WHERE categories.parent_id=285
AND languages.languages_id=1;

I have also noticed in my Windows command shell that it does not process 
extremely long lines in pastes from the clipboard well. If you copied 
that straight from Access to a MySQL prompt, it would have been just one 
long line of information and the DOS command processor would have 
eventually stopped taking input mid-query. I suspect that is what caused 
your otherwise acceptable (and I use that term loosely ;-)  ) query to 
be invalid. The last third of it never made it into the MySQL CLI.

When I break my queries into shorter lines (human friendly) and paste them 
into the MySQL command line interface (CLI), everything works just fine. 
Just copy the entire query (line breaks and all) onto the clipboard and 
paste it at the MySQL prompt (if that's how you are doing it) and see if 
it works now. Notepad is my best friend when working in the CLI. I compose 
and format long queries in Notepad then copy-paste into MySQL. I know it's 
doing it the hard way (yes, I have and do use the GUI tools too) but 
it's how I prefer to analyze certain issues.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


Daniel Sousa [EMAIL PROTECTED] wrote on 01/26/2005 06:45:32 AM:

 I have a problem.
 
 1064 - You have an error in your SQL syntax near '(((specials INNER 
 JOIN (products_to_categories INNER JOIN categories ON products' at line 
2
 
 SELECT DISTINCT specials.specials_id, products_to_categories.
 products_id, categories.parent_id, products_description.
 products_name, products.products_price, products.
 products_tax_class_id, products.products_image, specials.
 specials_new_products_price, languages.languages_id FROM languages 
 INNER JOIN (((specials INNER JOIN (products_to_categories INNER JOIN
 categories ON products_to_categories.categories_id = categories.
 categories_id) ON specials.products_id = products_to_categories.
 products_id) INNER JOIN products ON specials.products_id = products.
 products_id) INNER JOIN products_description ON specials.products_id
 = products_description.products_id) ON languages.languages_id = 
 products_description.language_id WHERE (((categories.parent_id)=285)
 AND ((languages.languages_id)=1))
 
 
 
 i run this query in my computer and work, but in the internet server 
don´t.
 
 If anyone can solve this problem answer me.
 
 Daniel Sousa


Re: error in your SQL syntax

2005-01-26 Thread Daniel Sousa
Thanks, works fines.

I use access because i don´t know a GUI tool that make SQL querys more easy.

Thanks all again,

Daniel Sousa
  - Original Message - 
  From: [EMAIL PROTECTED] 
  To: Daniel Sousa 
  Cc: mysql@lists.mysql.com 
  Sent: Wednesday, 26 January, 2005 14:57
  Subject: Re: error in your SQL syntax



  Here is your original query, reformatted merely so that we humans can read it 
better: 

  SELECT DISTINCT specials.specials_id 
  , products_to_categories.products_id 
  , categories.parent_id 
  , products_description.products_name 
  , products.products_price 
  , products.products_tax_class_id 
  , products.products_image 
  , specials.specials_new_products_price 
  , languages.languages_id 
  FROM languages 
  INNER JOIN 
  ( 
  ( 
  (specials INNER JOIN 
  (products_to_categories 
  INNER JOIN categories 
  ON products_to_categories.categories_id = 
categories.categories_id 
  )ON specials.products_id = 
products_to_categories.products_id 
  ) 
  INNER JOIN products 
  ON specials.products_id = products.products_id 
  ) 
  INNER JOIN products_description 
  ON specials.products_id = products_description.products_id 
  ) ON languages.languages_id = products_description.language_id 
  WHERE 
  ( 
  ( 
  (categories.parent_id)=285 
  ) AND ( 
  (languages.languages_id)=1 
  ) 
  ) 

  This query design stinks (reeks) of being autogenerated by M$ Access. The 
excessive use of parentheses when they aren't needed and the nested JOINs just 
complicate the query unnecessarily. 

  May I suggest a simplification? 


  SELECT DISTINCT specials.specials_id 
  , products_to_categories.products_id 
  , categories.parent_id 
  , products_description.products_name 
  , products.products_price 
  , products.products_tax_class_id 
  , products.products_image 
  , specials.specials_new_products_price 
  , languages.languages_id 
  FROM categories 
  INNER JOIN products_to_categories 
  ON products_to_categories.categories_id = categories.categories_id
 
  INNER JOIN products 
  ON products.products_id = products_to_categories.products_id 
  INNER JOIN specials 
  ON specials.products_id = products.products_id 
  INNER JOIN products_description 
  ON products.products_id = products_description.products_id 
  INNER JOIN languages 
  ON products_description.language_id = languages.languages_id 
  WHERE categories.parent_id=285 
  AND languages.languages_id=1; 

  I have also noticed in my Windows command shell that it does not process 
extremely long lines in pastes from the clipboard well. If you copied that 
straight from Access to a MySQL prompt, it would have been just one long line 
of information and the DOS command processor would have eventually stopped 
taking input mid-query. I suspect that is what caused your otherwise 
acceptable (and I use that term loosely ;-)  ) query to be invalid. The last 
third of it never made it into the MySQL CLI. 

  When I break my queries into shorter lines (human friendly) and paste them 
into the MySQL command line interface (CLI), everything works just fine. Just 
copy the entire query (line breaks and all) onto the clipboard and paste it at 
the MySQL prompt (if that's how you are doing it) and see if it works now. 
Notepad is my best friend when working in the CLI. I compose and format long 
queries in Notepad then copy-paste into MySQL. I know it's doing it the hard 
way (yes, I have and do use the GUI tools too) but it's how I prefer to 
analyze certain issues. 

  Shawn Green
  Database Administrator
  Unimin Corporation - Spruce Pine 


  Daniel Sousa [EMAIL PROTECTED] wrote on 01/26/2005 06:45:32 AM:

   I have a problem.
   
   1064 - You have an error in your SQL syntax near '(((specials INNER 
   JOIN (products_to_categories INNER JOIN categories ON products' at line 2
   
   SELECT DISTINCT specials.specials_id, products_to_categories.
   products_id, categories.parent_id, products_description.
   products_name, products.products_price, products.
   products_tax_class_id, products.products_image, specials.
   specials_new_products_price, languages.languages_id FROM languages 
   INNER JOIN (((specials INNER JOIN (products_to_categories INNER JOIN
   categories ON products_to_categories.categories_id = categories.
   categories_id) ON specials.products_id = products_to_categories.
   products_id) INNER JOIN products ON specials.products_id = products.
   products_id) INNER JOIN products_description ON specials.products_id
   = products_description.products_id) ON languages.languages_id

RE: error in your SQL syntax

2005-01-26 Thread Artem Koltsov
Try Query Browser ( http://dev.mysql.com/downloads/query-browser ) for building 
queries for MySQL.

Regards,

Artem

 -Original Message-
 From: Daniel Sousa [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 26, 2005 11:18 AM
 To: [EMAIL PROTECTED]
 Cc: mysql@lists.mysql.com
 Subject: Re: error in your SQL syntax
 
 
 Thanks, works fines.
 
 I use access because i don´t know a GUI tool that make SQL 
 querys more easy.
 
 Thanks all again,
 
 Daniel Sousa
   - Original Message - 
   From: [EMAIL PROTECTED] 
   To: Daniel Sousa 
   Cc: mysql@lists.mysql.com 
   Sent: Wednesday, 26 January, 2005 14:57
   Subject: Re: error in your SQL syntax
 
 
 
   Here is your original query, reformatted merely so that we 
 humans can read it better: 
 
   SELECT DISTINCT specials.specials_id 
   , products_to_categories.products_id 
   , categories.parent_id 
   , products_description.products_name 
   , products.products_price 
   , products.products_tax_class_id 
   , products.products_image 
   , specials.specials_new_products_price 
   , languages.languages_id 
   FROM languages 
   INNER JOIN 
   ( 
   ( 
   (specials INNER JOIN 
   (products_to_categories 
   INNER JOIN categories 
   ON 
 products_to_categories.categories_id = categories.categories_id 
   )ON specials.products_id = 
 products_to_categories.products_id 
   ) 
   INNER JOIN products 
   ON specials.products_id = 
 products.products_id 
   ) 
   INNER JOIN products_description 
   ON specials.products_id = products_description.products_id 
   ) ON languages.languages_id = products_description.language_id 
   WHERE 
   ( 
   ( 
   (categories.parent_id)=285 
   ) AND ( 
   (languages.languages_id)=1 
   ) 
   ) 
 
   This query design stinks (reeks) of being autogenerated by 
 M$ Access. The excessive use of parentheses when they aren't 
 needed and the nested JOINs just complicate the query unnecessarily. 
 
   May I suggest a simplification? 
 
 
   SELECT DISTINCT specials.specials_id 
   , products_to_categories.products_id 
   , categories.parent_id 
   , products_description.products_name 
   , products.products_price 
   , products.products_tax_class_id 
   , products.products_image 
   , specials.specials_new_products_price 
   , languages.languages_id 
   FROM categories 
   INNER JOIN products_to_categories 
   ON products_to_categories.categories_id = 
 categories.categories_id 
   INNER JOIN products 
   ON products.products_id = 
 products_to_categories.products_id 
   INNER JOIN specials 
   ON specials.products_id = products.products_id 
   INNER JOIN products_description 
   ON products.products_id = products_description.products_id 
   INNER JOIN languages 
   ON products_description.language_id = 
 languages.languages_id 
   WHERE categories.parent_id=285 
   AND languages.languages_id=1; 
 
   I have also noticed in my Windows command shell that it 
 does not process extremely long lines in pastes from the 
 clipboard well. If you copied that straight from Access to a 
 MySQL prompt, it would have been just one long line of 
 information and the DOS command processor would have 
 eventually stopped taking input mid-query. I suspect that is 
 what caused your otherwise acceptable (and I use that term 
 loosely ;-)  ) query to be invalid. The last third of it 
 never made it into the MySQL CLI. 
 
   When I break my queries into shorter lines (human friendly) 
 and paste them into the MySQL command line interface (CLI), 
 everything works just fine. Just copy the entire query (line 
 breaks and all) onto the clipboard and paste it at the MySQL 
 prompt (if that's how you are doing it) and see if it works 
 now. Notepad is my best friend when working in the CLI. I 
 compose and format long queries in Notepad then copy-paste 
 into MySQL. I know it's doing it the hard way (yes, I have 
 and do use the GUI tools too) but it's how I prefer to 
 analyze certain issues. 
 
   Shawn Green
   Database Administrator
   Unimin Corporation - Spruce Pine 
 
 
   Daniel Sousa [EMAIL PROTECTED] wrote on 01/26/2005 
 06:45:32 AM:
 
I have a problem.

1064 - You have an error in your SQL syntax near 
 '(((specials INNER 
JOIN (products_to_categories INNER JOIN categories ON 
 products' at line 2

SELECT DISTINCT specials.specials_id, products_to_categories.
products_id, categories.parent_id, products_description.
products_name, products.products_price, products.
products_tax_class_id, products.products_image, specials.
specials_new_products_price

Re: error in your SQL syntax near 'order by 'Variable_name' ????

2001-10-01 Thread Rodney Broom

From: [EMAIL PROTECTED]

 MySQL said: You have an error in your SQL syntax near 'order by 
 'Variable_name' ASC' at line 1 
 
 Any ideas as to what this means, and how to fix it?

Hi Dave,

How 'bout sending us the entire SQL statement, please.

---
Rodney Broom
Programmer: Desert.Net





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: error in your SQL syntax near 'order by 'Variable_name' ????

2001-10-01 Thread Emailit2

I don't know anything about MySQL, Ive just been trying(with no luck)to 
install a forum(Snitz forum from www.snitz.com) on my website. My website is 
Linux/MySQL/Chilisoft! Im running out of support my host hasn't gotten back 
with me, and Snitz support  doesn't know. So I got to messing around with the 
 control panel on my website and went to MySQL database. I clicked on: Show 
MySQL system variables. Then I could click on: Variable_name, or  Value both 
give me this:

MySQL said: You have an error in your SQL syntax near 'order by 'Value' ASC' 
at line 1

So I thought this might be what is keeping me from getting my forum started

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: error in your SQL syntax near 'order by 'Variable_name' ????

2001-10-01 Thread Benjamin Pflugmann

Hi.

On Mon, Oct 01, 2001 at 08:32:42PM -0400, [EMAIL PROTECTED] wrote:
 I don't know anything about MySQL, Ive just been trying(with no luck)to 
 install a forum(Snitz forum from www.snitz.com) on my website. My website is 
 Linux/MySQL/Chilisoft! Im running out of support my host hasn't gotten back 
 with me, and Snitz support  doesn't know. So I got to messing around with the 
  control panel on my website and went to MySQL database. I clicked on: Show 
 MySQL system variables. Then I could click on: Variable_name, or  Value both 
 give me this:
 
 MySQL said: You have an error in your SQL syntax near 'order by 'Value' ASC' 
 at line 1

This means that the clicking produced an invalid SQL
command. Seemingly it wanted to run

show variables order by 'Value' ASC

which is no valid command (SHOW VARIABLES doesn't allow an ORDER BY clause).

 So I thought this might be what is keeping me from getting my forum started

I assume that has nothin to do with that.

If you are interested: The above error seems to stem from the fact
that they use a general display this table page and append the
wished ordering to the last run SQL statement. This works fine for
normal SELECTS. 

But although SHOW VARIABLES returns a table, you may not append an
ORDER BY clause. Just a little oversight from their side, but it
should have nothing to do with other problems you may encounter.

Bye,

Benjamin.


-- 
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php