tags:

views:

53

answers:

1

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.

+3  A: 
SELECT
   t1.event
FROM
   t1
   JOIN t2 ON t1.nid = t2.nid
ORDER BY
   t2.time
tandu
Simple as that eh? Thanks very much, consider myself educated.
Daniel Matthews