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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DESC is the name of the data

Status
Not open for further replies.

MartinCouture

Technical User
Feb 16, 2002
57
CA
It's an aviation database which I can't change the name of the tables/data...

Being new at MySQL, this is the statement that I would like to run:

SELECT * FROM wpt WHERE DESC LIKE '%coe%

Which returns all the info about a waypoint that contains coe in its name, or like they want to call it : DESC.

Which returns an error because DESC is interpreted as a MySQL command/term...

Is there an escape character or something ? I tried 'DESC' and "DESC".

Thanks -----------------
[flush]
 
Try
Code:
SELECT * FROM wpt WHERE wpt.DESC LIKE '%coe%
, or even
Code:
SELECT * FROM wpt WHERE "wpt"."DESC" LIKE '%coe%
. -------------------------------------------

"Calculus is just the meaningless manipulation of higher symbols"
                          -unknown F student
 
Nope, no luck, it still thinks it's DESC as in MySQL'S DESCription.

I wonder why the aviation database uses DESC as a name... Is it the same for M$ Access databases or other SQLs ?

I can't be the first one to come accross this, it's the DAFIF database for the curious, under the waypoints database. ( -----------------
[flush]
 
This would really depend on how much data is in the db in the first place....
Any possibily of selecting everything into a temporay table with the name of the field changed and then querying the temp table?

Otherwise, how many things would need to be changed *if* you could change the name? ***************************************
Party on, dudes!
 
Thanks KarveR

You've hit the solution I think...

I copy the database and rename the DESC to DESCRIPTION. I've sent an e-mail to the military guys over there, but I don't realy expect them to change the military's database just for me.

They must not use that field in queries -----------------
[flush]
 
DESC is a reserved word in SQL for a Descending sort (the opposite of ASC). It really does break the SQL rules. I had a similar problem where a DB table was called FILE. Square brackets sometimes help...

Have you tried Select [Desc] from table;
Editor and Publisher of Crystal Clear
 
Just tried SELECT * FROM wpt WHERE [DESC] LIKE '%coe%'
and didn't like it... :-(

I'll have to copy the database and rename the field to DESCRIPTION... -----------------
[flush]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top