select d_start from (SELECT * FROM ( SELECT * FROM date WHERE 1 AND g_uid='380' ) d LEFT JOIN ( SELECT g_uid AS guid,tab,b_uid,m_uid,s_uid FROM good WHERE 1 AND g_uid='380' ) g ON g.guid=d.g_uid WHERE 1 AND g_uid='380' AND d_start = '')A LEFT JOIN (SELECT dtid AS d_tid,order_num FROM TB_GOOD_DATE_TYPE)B ON A.dtid=B.d_tid ORDER BY order_num where 1 and g_uid='380' and d_type='A' order by d_start desc limit 1

1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where 1 and g_uid='380' and d_type='A' order by d_start desc limit 1' at line 5

error file : /daytour/tour_view.html