I need to add the date of the last communication with a customer to an aged debtors report. Of course if I use a regular join to the contact_history table for this I end up duplicating the financial records by the number of communication events.
Using regular SQL this could be done with a subquery; something like:
INNER JOIN (SELECT refn, max(contact_date) FROM contact_history GROUP BY refn) last ON sales_ledger.account_ref = last.refn
Is it possible to achieve something similar in Report Designer?
Need more, need help now?
- - - - - - - - - - - - - - - - - - pay-as-you-go support - no contract - tenth of an hour billing - expert help - fast service - no call queues
Need integration?
- - - - - - - - - - - - - - - - - - with your shipping system - website - invoicing system - crm - cms - manufacturing - order import - back to back orders..
Need a report?
- - - - - - - - - - - - - - - - - - Excel reporting that pulls data from Sage - custom layouts - layouts that change adapt to your brands and/or for drop shipping.
Want web hosting?
- - - - - - - - - - - - - - - - - - Your own domain name - email - a shop - wordpress - woo commerce - ticket systems - help desks - forums - portals
- - - - - - - - - - - - - - - - - - pay-as-you-go support - no contract - tenth of an hour billing - expert help - fast service - no call queues
Need integration?
- - - - - - - - - - - - - - - - - - with your shipping system - website - invoicing system - crm - cms - manufacturing - order import - back to back orders..
Need a report?
- - - - - - - - - - - - - - - - - - Excel reporting that pulls data from Sage - custom layouts - layouts that change adapt to your brands and/or for drop shipping.
Want web hosting?
- - - - - - - - - - - - - - - - - - Your own domain name - email - a shop - wordpress - woo commerce - ticket systems - help desks - forums - portals
Joining on subqueries
- brucedenney
- Site Admin
- Posts: 4631
- Joined: 28 Feb 2006, 09:56
- Sage Version: v28 UK/Europe/Africa
Re: Joining on subqueries
Yes and No it is possible but...
You have to accept that it will return a huge amount of data, if you make sure the data is sorted by contact date, then create a group for the contact, hide all the details and only show the group footer, in the group footer when you refer to the contact, it will be the last contact it saw, which in turn id the last dated contact.
Nasty and inefficient but it will work.
You have to accept that it will return a huge amount of data, if you make sure the data is sorted by contact date, then create a group for the contact, hide all the details and only show the group footer, in the group footer when you refer to the contact, it will be the last contact it saw, which in turn id the last dated contact.
Nasty and inefficient but it will work.
For just about anything Sage :- Discount subscriptions, pay-as-you-go support, application integration, reports, layouts, linked excel spreadsheets, analysis or any other help making life with sage easier/less time consuming Contact me.
Re: Joining on subqueries
Yes, it does. As you say it is horribly inefficient though. It's a shame there isn't more user control over the underlying SQL.
- brucedenney
- Site Admin
- Posts: 4631
- Joined: 28 Feb 2006, 09:56
- Sage Version: v28 UK/Europe/Africa
Re: Joining on subqueries
The fundamental problem is that the database is not an sql database it is a series of flat files with indexes.
For just about anything Sage :- Discount subscriptions, pay-as-you-go support, application integration, reports, layouts, linked excel spreadsheets, analysis or any other help making life with sage easier/less time consuming Contact me.
Who is online
Users browsing this forum: No registered users and 1 guest