Jump to content

Select based on substring


sandy1028

Recommended Posts

Hi,

 

SUBSTRING(string, offset, length)

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring

 

 

Like "2010/07/12/abc" datas the conversion eg is:

SELECT CONVERT(SUBSTRING(date_column, 1, 10), DATETIME) FROM table;

-> date_column's content let there be here eg: '1980/01/01abcdef...'

-> The result will be 1980-01-01 00:00:00 just like your another table value:

and in another table value is in the format '2010-07-12 00:00:00'.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.