Hi,

I have a minimal db model with two tables: FILE and TICKET. A FILE is
a collection of TICKETs, and a TICKET can only belong to one FILE. I'm
pasting the relationship below, hoping you can see it using a fixed
font.


                           +------------------+                              
+-------------------+
                           |                  |                 X            |  
                 |
                           |                  |1               / \
N|                   |
                           |      FILE        +<--------------X
X=========>|         TICKET      |
                           |                  |                \ /           |  
                 |
                           |                  |                 X            |  
                 |
                           +------------------+                              
+-------------------+

The FILE table doesn't contain an explicit column for the number of
associated tickets. I don't want to denormalize the model if I can
avoid it.
I present the list of files in a datagrid, defining a new column
'tickets', with a custom :reader function, to display that information
for each ticket. However, the built-in sort feature fails since it
uses a generic way consisting of autogenerated sql queries, and that
information is not explicit in the FILE table:

While accessing database #<MYSQL-DATABASE localhost/prj/prj OPEN
{B8FF6D9}>
  with expression "SELECT FILE.NAME,FILE.ID,FILE.TICKETS FROM FILE
ORDER BY FILE.TICKETS ASC LIMIT 6 OFFSET 0":
  Error 1054 / Unknown column 'FILE.TICKETS' in 'field list'
  has occurred.

I just need a way to customize the generated query, in order to do the
join myself and count the number of TICKETs pointing to each FILE. How
can I override that query?

Thank you in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to