MYSQL and PHP cast() function...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

I have  been trying to get a solution to this select query from all over the
web and have found no answer so I was hoping someone here could help out.
The date field of the database is imported from a text file with the date
format 'dd-mm-yyyy hh:mm:ss' and I only want to display the first 11
characters of the field.

The select statment is am using is
$query2 = "select Title, cast(Date as varchar(11)) Date, Artist, Country,
RecordCompany, CatalogueNumber, Composer FROM recording where title regexp
'$keyword'";

However when I try to use this I get an error about the cast function as
follows:

You have an error in your SQL syntax near '(Date as varchar(11)) Date,
Artist, Country, RecordCompany, CatalogueNumber, Com' at line 1

Can anyone help me with the cast() function. I have gotten this to work on
an internal MSSQL server but not on the MySQL server.

thanks

Morgan Bardon





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux