|
|||||||||||
|
[NOVICE] Postgres Joins ?
From: Tony Wade <postgres(at)wade.co.za>
Date: Tue Oct 23 2007 - 18:05:25 EDT
Would someone be able to assist with the following Postgres Query. select t.id,q.name,t.subject,u.name,t.status,t.created,t.resolved,ov.content,ov.created as Updated from tickets t, queues q, users u, objectcustomfieldvalues ov where t.created > '2007-10-02 00:00:00' AND t.queue = 6 and t.queue = q.id AND t.owner = u.id and ov.objectid = t.id and ov.customfield = 21 order by t.id; which returns the following: id | name | subject | name | status | created | resolved | content | updated -------+-----------+-----------------------------------------------------------------------------------+--------------+----------+-------- 12345 Fred Purchase bob Resolved 2007-10-21 14:01:23 2007-10-31 09:03:40 Captured 2007-10-21 14:03:32 12345 Fred Purchase bob Resolved 2007-10-21 14:01:23 2007-10-31 09:03:40 Released to WH 2007-10-22 07:34:01 12345 Fred Purchase bob Resolved 2007-10-21 14:01:23 2007-10-31 09:03:40 Delivered 2007-10-31 08:58:53 What I'd like to have is the following: id | name | subject | name | status | created |captured | released to wh | delivered | resolved 12345 Fred Purchase bob Resolved 2007-10-21 14:01:23 2007-10-21 14:03:32 2007-10-22 07:34:01 2007-10-31 08:58:53 2007-10-31 09:03:40 Is this possible ? I suspect it requires the use of Joins in some manner, but my SQL knowledge is not up to scratch. I'd appreciate it if someone could point me in the right direction. Regards,
Tony Wade
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
Received on Tue Oct 23 18:37:20 2007This archive was generated by hypermail 2.1.8 : Thu Jun 19 2008 - 00:03:22 EDT |
||||||||||
|
|||||||||||