Hi - I am trying to create a Select query that would give me individual Nodes with Location, Date, and Taxonomy information.

I am trying to use this:

SELECT node.nid, node.title, content_type_tour.field_date_value AS Date_Start, content_type_tour.field_date_value2 AS Date_End, location.province AS Province, term_data.name AS Category

FROM defdrupal.node

LEFT JOIN content_type_tour
ON node.nid = content_type_tour.nid
LEFT JOIN location
ON node.nid = location.eid

LEFT JOIN term_node
ON node.nid = term_node.nid

LEFT JOIN term_data
ON term_node.tid = term_data.tid

WHERE node.type = "tour"
ORDER BY node.nid

this works pretty close - but I am getting multiple instances of the same Node - I am guessing this has to do with the MySQL table joins.

Do you have any advice?

Comments

gonz’s picture

I guess I should mention that I created a content type called "tour" (for music tour events) - I have CCK Date fields in there as well as Taxonomy by the Artist who is on tour.

I hope that helps clarify what I am trying to accomplish.

I then want to export this Select statement as an XML document so I can use it with a dynamic Flash Calendar.

I know this is a lot going on - but it should be pretty cool.

- thanks in Advance.