I recently had a very frustrating and puzzling experience when building
and querying a table. The structure is as follows:
CREATE TABLE `invoices` (
`ClientID` tinyint(3) unsigned NOT NULL default '0',
`Invoice` smallint(4) unsigned NOT NULL default '0',
`IssueDate` date NOT NULL default '0000-00-00',
`PaidDate` date default '0000-00-00',
`Services` text NOT NULL,
`Subtotal` decimal(5,2) NOT NULL default '0.00',
`PrevBal` decimal(5,2) NOT NULL default '0.00',
`GST` decimal(5,2) NOT NULL default '0.00',
`ChequeNum` varchar(6) NOT NULL default '',
`AmtPaid` decimal(5,2) NOT NULL default '0.00',
`Partial` char(1) NOT NULL default 'N'
) TYPE=MyISAM;
After populating some of the records, I tried to do a query based on the
field 'partial', which I use to indicate whether the payment is a
partial one or not. However, every attempt I made to get at 'partial'
resulted in an error. I discovered that I could access the field by
using 'invoices.partial'. Hmmm. I was onto something. I figured
'partial' must be a keyword.
After pulling my hair out (what little I have left), and scouring
through all my MySQL books without finding *any* reference to 'partial'
as a keyword, I finally went to the online version of the manual.
Eureka! I discovered that 'partial' is a *reserved* word
(http://www.mysql.com/doc/en/Reserved_words.html).
So, for all the *other* folks wondering why a query that otherwise looks
fine is barking at them, check the URL above and see if you are trying
to use a reserved word.
Thanks to the all the folks on the list and MySQL for a terrific
product.
--
/* All outgoing email scanned by Norton Antivirus 2002 */
Amer Neely, Softouch Information Services
W: www.softouch.on.ca
E: aneely@stripped
V: 519.438.5887
Perl | PHP | MySQL | CGI programming for all data entry forms.
"We make web sites work!"