Edgewall Software

Changes between Version 7 and Version 8 of TracIniReportCustomFieldSample


Ignore:
Timestamp:
Mar 30, 2007, 12:57:45 PM (17 years ago)
Author:
anonymous
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • TracIniReportCustomFieldSample

    v7 v8  
    154154
    155155}}}
     156
     157== Example 5 ==
     158We wanted to query  all custom_ticket.value of a certain type (custom_ticket.name), where a different custom_ticket.value of the same ticket was met.
     159
     160'''trac.ini:'''
     161{{{
     162[ticket-custom]
     163duration = text
     164duratino.label = Duration
     165
     166customer = text
     167customer.label = Customer
     168}}}
     169
     170This obviously didn't work:
     171
     172'''Custom SQL:'''
     173
     174{{{
     175SELECT
     176  ticket_custom.value as Duration,
     177  FROM ticket_custom
     178  WHERE ticket_custom.name = 'duration'
     179  AND ticket_custom.value = 'Our Customer'
     180}}}
     181
     182What we did was make a "loop" INNER JOIN ticket_custom on ticket_custom.ticket like this:
     183
     184'''Custom SQL:'''
     185
     186{{{
     187SELECT
     188  tc1.value as Duration,
     189  FROM ticket_custom tc1
     190  INNER JOIN ticket_custom tc2
     191  ON tc1.ticket = tc2.ticket
     192  WHERE tc1.name = 'duration'
     193  AND tc2.value = 'Our Customer'
     194}}}