Jump to content
  • 0

Custom Report To Mailchimp ->Need Help


Doctrine
 Share

Question

Hello,

 

I need help about the custom reports. Its not so easy to do it because i have multi company

 

client first name, client last name, client email, client country, client service names, client addon company (i got 1 addon company and dont know how to...)

 

I am in a different situation as i got Hungarian clients and international clients. So one company - one company. I have to seperate it very well.

 

Please somebody give me a code for that

 

For now i only got this:

SELECT contacts.first_name, contacts.last_name, contacts.email, contacts.country
FROM contacts
ORDER BY contacts.country;

I need client service name and order by company ID

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Are you familiar with selecting service information? I'll assume so and let you work out that part.

 

To narrow it down to a specific company, you will want to join with client groups, i.e.

SELECT `client_groups`.`company_id`, contacts.first_name, contacts.last_name, contacts.email, contacts.country
FROM contacts
INNER JOIN `clients` ON `clients`.`id` = `contacts`.`client_id`
INNER JOIN `client_groups` ON `client_groups`.`id` = `clients`.`client_group_id`
ORDER BY `client_groups`.`company_id` ASC, contacts.country ASC;
Link to comment
Share on other sites

  • 0

 

Are you familiar with selecting service information? I'll assume so and let you work out that part.

 

To narrow it down to a specific company, you will want to join with client groups, i.e.

SELECT `client_groups`.`company_id`, contacts.first_name, contacts.last_name, contacts.email, contacts.country
FROM contacts
INNER JOIN `clients` ON `clients`.`id` = `contacts`.`client_id`
INNER JOIN `client_groups` ON `client_groups`.`id` = `clients`.`client_group_id`
ORDER BY `client_groups`.`company_id` ASC, contacts.country ASC;

Great! Thank you! Could we list the service names too which the client has?

 

Thanks

Peter

Link to comment
Share on other sites

  • 0

The query only fetches contacts. If you wanted service information, you might select only the primary client contact, and list them multiple times, once for each service they have.

 

However, the service name ("Label" in Blesta) is derived from one of the service fields determined by the module. That relationship could not be determined from a query since the module's chosen service name is not stored in the database. In other words, you could list all of the service fields for a service in a column, but you wouldn't know which one is used as the service name.

 

If you know the name of the service field used as the service name for every module in your system, then you could add each one manually to the query to get just the service name.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...