sandy1028 Posted July 21, 2010 Share Posted July 21, 2010 How to write the query and select all the ids which has the differnet values. In table 1, value is '2010/07/12/abc' and in another table value is in the format '2010-07-12 00:00:00'. How to compare from two tables if 2010,07,12 are same. Link to comment https://forums.phpfreaks.com/topic/208389-select-based-on-substring/ Share on other sites More sharing options...
bh Posted July 21, 2010 Share Posted July 21, 2010 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'. Link to comment https://forums.phpfreaks.com/topic/208389-select-based-on-substring/#findComment-1089071 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.