Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie question, trying to query a table with column names like Transaction Date 1

Status
Not open for further replies.

Jacque

Technical User
Nov 9, 2001
301
0
0
US
I'm attempting to query a table with column names that have spaces.
I've only used MySQL a little bit, so I'm at a loss.

I've tried ' (single quotes) which comments out the field.
I've tried " (double quotes) which just makes it text.
I've tried placing the following wildcards in place of the spaces % or _ or *.

But nothing has worked, what am I doing wrong?
Any help would be appreciated.

Aghhhhhh![hairpull]
 
Do not have MYSQL open but on SQL server you wrap field name in square brackets []

eg

Select [Transaction date] from your table

As a general rule try not to create field names with spaces either use

TransactionDate or Transaction_date

Ian
 
I Totally agree with Ian, don't use spaces in table names, you will find a world of pain in the future with coding/using tables with spaces in the names.


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Thanks all, and believe me, I totally agree with not using spaces but I didn't create the db, I just have to report from it.
Ian, I also tried using brackets (I'm much more comfortable with SQL server) but it didn't work.
And Feherke - a star for you, the backtick did the trick. [thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top