I'm currently working on Drupal site, building a custom JSON module for a project at work.
I'm trying to join data of events from the drupal node table to a date field associated with it, stored in another table. This cannot be altered.
What i want to do, is run a query to fetch the list of events from the node table, and but i need to order the list returned by the timestamp in the date field, which is stored in the other table.
The two are related by their 'nid' (node id).
I realise this is probably quite simple in terms of relational databases, but i've never written a relational query in my life, so please educate me :)
Thanks.
SELECT
t1.event
FROM
t1
JOIN t2 ON t1.nid = t2.nid
ORDER BY
t2.time
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.