I have an interesting problem, let me start off with, this database is not of my design, is an absolute mess, and there is nothing I can do about it.
Expand|Select|Wrap|Line Numbers
- SELECT distinct(`Tickets`.`EffectiveId`), `Tickets`.`Subject`, `Tickets`.`Created`, `Transactions`.`OldValue`,
- `Transactions`.`NewValue`, `Transactions`.`Created` as `Tcreated`,
- `ObjectCustomFieldValues`.`Content` as `sev`,
- `ObjectCustomFieldValues`.`Content` as `tt`
- from `Tickets`
- Left join (`Transactions`, `ObjectCustomFieldValues`)
- on (`Tickets`.`EffectiveId` = `Transactions`.`ObjectId`
- and `ObjectCustomFieldValues`.`ObjectId` = `Tickets`.`EffectiveId`)
- where `Tickets`.`id` = `Tickets`.`EffectiveId`
- and `Tickets`.`Created` >='2009-08-01 07:00:00'
- and `Tickets`.`Created` <= '2009-08-31 23:59:59'
- and (`Tickets`.`Status` = 'resolved'
- or `Tickets`.`Status` = 'closed')
- and `Transactions`.`Type` = 'Status'
- and (`ObjectCustomFieldValues`.`CustomField` = '32' or `ObjectCustomFieldValues`.`CustomField`= '24')
- and `ObjectCustomFieldValues`.`Disabled` = '0'
- order by `Tcreated`, `Tickets`.`EffectiveId` asc;
I would like to see the sev and tt as separate columns with the data for their CustomField id in each row returned.
If I cannot figure this out, I'll just start writing to a more useful database, where the information for each field I need in in a separate column or table etc... I am just hoping I can get some help before it gets to this point.
Thanks,
TC