sql >> Base de Datos >  >> RDS >> Mysql

Cómo reformular una consulta sql

¿Funcionaría algo como esto?

SELECT
    max(a.field_date_and_time_value2) as last_time
    , b.uid
FROM field_data_field_date_and_time a
    INNER JOIN
        node b
    ON
        /* this piece might be wrong. what is the relationship between the first table and the second one? */
        b.nid = '".$node->nid."'
where
    a.field_date_and_time_value2 > '".$today."' AND
    b.uid = $node->nid