есть вот такой запрос сформированый через views:
SELECT node.nid AS nid,
node_data_field_time_order.field_time_order_value AS node_data_field_time_order_field_time_order_value,
node_data_field_time_order.field_time_order_value2 AS node_data_field_time_order_field_time_order_value2,
node.type AS node_type,
node.vid AS node_vid
FROM node node
INNER JOIN content_type_order node_data_field_sauna_number ON node.vid = node_data_field_sauna_number.vid
LEFT JOIN content_type_order node_data_field_time_order ON node.vid = node_data_field_time_order.vid
WHERE ((node.type IN ('order')) AND (node_data_field_sauna_number.field_sauna_number_value = '11'))
node_data_field_time_order.field_time_order_value AS node_data_field_time_order_field_time_order_value,
node_data_field_time_order.field_time_order_value2 AS node_data_field_time_order_field_time_order_value2,
node.type AS node_type,
node.vid AS node_vid
FROM node node
INNER JOIN content_type_order node_data_field_sauna_number ON node.vid = node_data_field_sauna_number.vid
LEFT JOIN content_type_order node_data_field_time_order ON node.vid = node_data_field_time_order.vid
WHERE ((node.type IN ('order')) AND (node_data_field_sauna_number.field_sauna_number_value = '11'))
Он работает везде, и во вьевс чтото возвращает и в phpmyadmin, и просто в файле(те нода с форматом ввода php)
и есть вот такой
SELECT node.nid AS nid,
node_data_field_time_order.field_time_order_value AS node_data_field_time_order_field_time_order_value,
node_data_field_time_order.field_time_order_value2 AS node_data_field_time_order_field_time_order_value2,
node.type AS node_type,
node.vid AS node_vid
FROM node node
INNER JOIN content_type_order node_data_field_sauna_number ON node.vid = node_data_field_sauna_number.vid
LEFT JOIN content_type_order node_data_field_time_order ON node.vid = node_data_field_time_order.vid
WHERE ((node.type IN ('order')) AND (node_data_field_sauna_number.field_sauna_number_value = '11'))
AND (DATE_FORMAT(ADDTIME(node_data_field_time_order.field_time_order_value, SEC_TO_TIME(28800)), '%Y-%m-%d') >= '2009-09-24')
node_data_field_time_order.field_time_order_value AS node_data_field_time_order_field_time_order_value,
node_data_field_time_order.field_time_order_value2 AS node_data_field_time_order_field_time_order_value2,
node.type AS node_type,
node.vid AS node_vid
FROM node node
INNER JOIN content_type_order node_data_field_sauna_number ON node.vid = node_data_field_sauna_number.vid
LEFT JOIN content_type_order node_data_field_time_order ON node.vid = node_data_field_time_order.vid
WHERE ((node.type IN ('order')) AND (node_data_field_sauna_number.field_sauna_number_value = '11'))
AND (DATE_FORMAT(ADDTIME(node_data_field_time_order.field_time_order_value, SEC_TO_TIME(28800)), '%Y-%m-%d') >= '2009-09-24')
который работает во вьевс, phpmyadmin но не работает в файле
запросы идентичны кроме последнего условия.
как так?
Комментарии
Писалось не раз!!! %d друпалом воспринимается как переменная для функции db_query
DATE_FORMAT(ADDTIME(node_data_field_time_order.field_time_order_value, SEC_TO_TIME(28800)),
'%Y-%m-%d') >= '2009-09-24');
заменить %d на %%d и будет вам все работать
хз, проблема с символом '%' наверна
АААААААААААААААААААААААААААА
Полдня убил!
Спасибо!