mySQL Query Browser errors

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Does mySQL not like dashes or something?  I seem to be getting the
following error:

"Unknown column 'etrans' in 'where clause'"

when I do the following query:

SELECT * from expense where etrans-num > 25

If I try:
SELECT * from expense where expense.'etrans-num' > 25

I get:

"You have an error in your SQL syntax, Check the manual that
corresponds to your MySQL version for the right syntax to use near
"etrans-num' > 25' at line 1

What's wrong with using dashes in field names?????


Re: mySQL Query Browser errors

PW Herman wrote:
Quoted text here. Click to load it

They're too easily confused with the subtraction operator.
FWIW, I can't think of a single programming language that permits dashes
in identifiers.

MySQL uses backticks `` as an identifier delimiter, if you need special
characters, spaces, reserved words, etc. in your field names.

Try this:
   SELECT * from expense where expense.`etrans-num` > 25

Bill K.

Site Timeline