Is this a table name: database_name_com_-_mambo.mos_sections ?
If not you’re not doing it right. If some of that is a database name
it’s also probably wrong… Post the output of ‘show tables’ from
within mysql.
Good luck.
ram88 wrote:
> Hi!
> I have some problem with MySql syntax. I’ getting error when trying to
>
> Code:
> --------------------
> SELECT * FROM database_name_com_-_mambo.mos_sections;
> --------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
show db:
±--------------------------+
| Database |
±--------------------------+
| information_schema |
| dombosfest_org_yu_-_mambo | ** In my first post I’m replaced with “database_name_com_-_mambo”.
| test |
| testDb |
| testDb2 |
±--------------------------+
without any problems. (testTable1 is a TABLE from testDb DATABASE)
±-----------------+
| Tables_in_testDb |
±-----------------+
| testTable1 |
±-----------------+
MySQL :: MySQL 5.0 Reference Manual :: 8.2 Schema Object Names makes it clear that identifiers that contain more than alphanumerics, _ and $ must be quoted. It is possible that the mysql parser lets you get away without the quoting using the backtick character ` in some situations, but in general you need to quote whenever you have a special character.
Presumably the hyphen in your expression could be confused as the minus operator by the parser in some contexts and so the identifiers there need quoting.
Why not just stay out of trouble and not use names with hyphens?
SELECT * FROM dombosfest_org_yu_-_mambo.mos_sections;
Note that those are backticks surrounding the DB/table names… I
couldn’t make single-quotes (ticks) or double-quotes work.
Good luck.
ram88 wrote:
> ken_yap;1861006 Wrote:
>> Why not just stay out of trouble and not use names with hyphens?
> I don’t like to use dashes and underscores, this is one backup from
> phpMyAdmin.
> Thanks for help!
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
And one wouldn’t expect them to. The doco states that the quoting character for names with special characters is the backtick. Single and double quotes would create string literals.