On Fri, Jan 11, 2013 at 8:37 AM, Richard Hipp <d...@sqlite.org> wrote:

>
> The "status" field is coming from the ticket table and thus shows the
> latest status.  To show the latest status at some point in the past, you
> need a (I think) to first add a "status" field to your "ticketchng" table
> definition.  Then modify the query to be something like this (untested):
>
>
> SELECT DISTINCT
>     date(ticket.tkt_mtime),
>     substr(tkt_uuid,1,10) AS '#',
>     (SELECT status FROM tkt_chng AS chng2
>        WHERE chng2.tkt_id = ckc1.tkt_id
>             AND chng2.tkt_time <= chng1.tkt_time
>             AND chng2.status IS NOT NULL
>             ORDER BY chng2.tkt_time DESC LIMIT 1),
>     login,
>     title
> FROM ticket AS tkt1 LEFT OUTER JOIN ticketchng AS chng1
> ON tkt1.tkt_id = chng1.tkt_id
> ORDER BY tkt1.tkt_mtime desc
>

Later today, I'll try to find time to enhance Fossil so that you can
accomplish the above merely by creating a "status" column in the TICKETCHNG
table and omitting the subquery.



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to