Postgres Joins ?
От | Tony Wade |
---|---|
Тема | Postgres Joins ? |
Дата | |
Msg-id | 20071023220525.GL4681@postman.stonemanor.co.za обсуждение исходный текст |
Ответы |
Re: Postgres Joins ?
Re: Postgres Joins ? |
Список | pgsql-novice |
Hi, 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, queuesq, users u, objectcustomfieldvalues ov where t.created > '2007-10-02 00:00:00' AND t.queue = 6 and t.queue = q.id ANDt.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-2114:03:32 12345 Fred Purchase bob Resolved 2007-10-21 14:01:23 2007-10-31 09:03:40 Released to WH 2007-10-2207:34:01 12345 Fred Purchase bob Resolved 2007-10-21 14:01:23 2007-10-31 09:03:40 Delivered 2007-10-3108: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'dappreciate it if someone could point me in the right direction. Regards, Tony Wade postgres@wade.co.za
В списке pgsql-novice по дате отправления: