-1

I have the following MySQL statement:

(SELECT car_id,firstname,surname,email,tel,postcode,add1,add2,town,county,optin-email FROM `contacts`) 
UNION 
(SELECT car_name,firstname,surname,email,tel,postcode,add1,add2,town,county,optin-email FROM `signup`)

Within this database is a row called optin-email - I cannot change the name of this row, I just wondered if there was a way to select it without making MySQL error?

Florent
  • 12,310
  • 10
  • 49
  • 58
Barrie Reader
  • 10,647
  • 11
  • 71
  • 139

1 Answers1

2

Try enclose the names within `` (bact-ticks)

Hyphens are a big problem because if you end up mapping a column name to a variable, most languages do not like to have hyphens inside variable names.

In MySQL, use the back-ticks. In standard SQL, use double-quotes.

Linga
  • 10,379
  • 10
  • 52
  • 104