Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
SELECT
contact.id,contact.main_contact_id,contacttitle.`name` as title,contact.company,contact.firstname,contact.lastname,contact.street,contact.zipcode,contact.city,contactstate.`name` as state,contactcountry.`name` as country,contact.phone,contact.phone2,contact.fax,contact.email,contact.mobile,contact.homepage,contact.`comment`,contact.street_private,contact.zipcode_private,contact.city_private,privatestate.`name` as state_private,privatecountry.`name` as country_private,contact.phone_private,contact.phone2_private,contact.fax_private,contact.department,contact.birthday
FROM
contact
LEFT JOIN type_state as contactstate ON contactstate.id = contact.state
LEFT JOIN type_state as privatestate ON privatestate.id = contact.state_private
LEFT JOIN type_title as contacttitle ON contacttitle.id = contact.title_id
LEFT JOIN type_country as contactcountry ON contactcountry.id = contact.country_id
LEFT JOIN type_country as privatecountry ON privatecountry.id = contact.country_id_private
WHERE
contact.deleted = 0
ORDER by main_contact_id ASC

Kontakte aus antony exportieren (über Navicat) mit Mapping der Kontaktdaten auf Ansprechpartner

(Firma, Vorname, Name, Straße, PLZ, Ort)

Code Block
languagesql
SELECT
contact.id,contact.main_contact_id,contacttitle.`name` as title,if(contact.company <> '', contact.company, main_contact.company) as company,if(contact.firstname <> '', contact.firstname, main_contact.firstname) as firstname,if(contact.lastname <> '', contact.lastname, main_contact.lastname) as lastname,if(contact.street <> '', contact.street, main_contact.street) as street,if(contact.zipcode <> '', contact.zipcode, main_contact.zipcode) as zipcode,if(contact.city <> '', contact.city, main_contact.city) as city,contactstate.`name` as state,contactcountry.`name` as country,contact.phone,contact.phone2,contact.fax,contact.email,contact.mobile,contact.homepage,contact.`comment`,contact.street_private,contact.zipcode_private,contact.city_private,privatestate.`name` as state_private,privatecountry.`name` as country_private,contact.phone_private,contact.phone2_private,contact.fax_private,contact.department,contact.birthday
FROM
contact
INNER JOIN instance_properties as ip ON ip.object_id = contact.id AND ip.instance_id = 1
LEFT JOIN type_state as contactstate ON contactstate.id = contact.state
LEFT JOIN type_state as privatestate ON privatestate.id = contact.state_private
LEFT JOIN type_title as contacttitle ON contacttitle.id = contact.title_id
LEFT JOIN type_country as contactcountry ON contactcountry.id = contact.country_id
LEFT JOIN type_country as privatecountry ON privatecountry.id = contact.country_id_private
LEFT join contact as main_contact ON contact.main_contact_id = main_contact.id
WHERE
contact.deleted = 0 AND ip.deleted = 0
ORDER by main_contact_id ASC

Kontakte aus antony exportieren. Nur eine Kontaktgruppe, inkl. Stichworten

Code Block
languagesql
SELECT
(SELECT GROUP_CONCAT(DISTINCT tags.text SEPARATOR ',') FROM tags WHERE (tags.id = SUBSTRING_INDEX(SUBSTRING_INDEX(ip.tags, '\|', 2), '\|', -1) or tags.id = SUBSTRING_INDEX(SUBSTRING_INDEX(ip.tags, '\|', 3), '\|', -1) or tags.id = SUBSTRING_INDEX(SUBSTRING_INDEX(ip.tags, '\|', 4), '\|', -1) or tags.id = SUBSTRING_INDEX(SUBSTRING_INDEX(ip.tags, '\|', 5), '\|', -1)) AND tags.text <> ''),
contact.id,contact.main_contact_id,contacttitle.`name` as title,contact.company,contact.firstname,contact.lastname,contact.street,contact.zipcode,contact.city,contactstate.`name` as state,contactcountry.`name` as country,contact.phone,contact.phone2,contact.fax,contact.email,contact.mobile,contact.homepage,contact.`comment`,contact.street_private,contact.zipcode_private,contact.city_private,privatestate.`name` as state_private,privatecountry.`name` as country_private,contact.phone_private,contact.phone2_private,contact.fax_private,contact.department,contact.birthday
FROM
`contact-group`, contact
LEFT JOIN type_state as contactstate ON contactstate.id = contact.state
LEFT JOIN type_state as privatestate ON privatestate.id = contact.state_private
LEFT JOIN type_title as contacttitle ON contacttitle.id = contact.title_id
LEFT JOIN type_country as contactcountry ON contactcountry.id = contact.country_id
LEFT JOIN type_country as privatecountry ON privatecountry.id = contact.country_id_private
LEFT JOIN instance_properties as ip ON ip.object_id = contact.id AND ip.instance_id = 1
WHERE
contact.deleted = 0 AND
`contact-group`.contact_id = contact.id AND `contact-group`.group_id = 3
AND ip.tags <> ''
ORDER by main_contact_id ASC

Kontakte exportieren (z.B. für Cleverreach)

Code Block
languagesql
SELECT
(SELECT GROUP_CONCAT(DISTINCT tags.text SEPARATOR ',') FROM tags WHERE (tags.id = SUBSTRING_INDEX(SUBSTRING_INDEX(ip.tags, '\|', 2), '\|', -1) or tags.id = SUBSTRING_INDEX(SUBSTRING_INDEX(ip.tags, '\|', 3), '\|', -1) or tags.id = SUBSTRING_INDEX(SUBSTRING_INDEX(ip.tags, '\|', 4), '\|', -1) or tags.id = SUBSTRING_INDEX(SUBSTRING_INDEX(ip.tags, '\|', 5), '\|', -1)) AND tags.text <> '') as interesse_an,
contact.id,contact.main_contact_id,contacttitle.`name` as title,contact.company,contact.firstname,contact.lastname,contact.street,contact.zipcode,contact.city,contactstate.`name` as state,contactcountry.`name` as country,contact.phone,contact.phone2,contact.fax,contact.email,contact.mobile,contact.homepage,contact.street_private,contact.zipcode_private,contact.city_private,privatestate.`name` as state_private,privatecountry.`name` as country_private,contact.phone_private,contact.phone2_private,contact.fax_private,contact.department,contact.birthday
FROM
`contact-group`, contact
LEFT JOIN type_state as contactstate ON contactstate.id = contact.state
LEFT JOIN type_state as privatestate ON privatestate.id = contact.state_private
LEFT JOIN type_title as contacttitle ON contacttitle.id = contact.title_id
LEFT JOIN type_country as contactcountry ON contactcountry.id = contact.country_id
LEFT JOIN type_country as privatecountry ON privatecountry.id = contact.country_id_private
LEFT JOIN instance_properties as ip ON ip.object_id = contact.id AND ip.instance_id = 1
WHERE
contact.deleted = 0 AND contact.email <> '' AND
`contact-group`.contact_id = contact.id AND `contact-group`.group_id = 4
AND ip.tags <> ''
ORDER by main_contact_id ASC

Termine aus antony als CSV exportieren (über Navicat)

Code Block
languagesql
select 
allday as 'ganztaegiges ereigniss', 
DATE_FORMAT(start, '%Y-%m-%d') as 'beginnt am',
DATE_FORMAT(start, '%T') as 'beginnt um', 
DATE_FORMAT(end, '%Y-%m-%d') as 'endet am',
DATE_FORMAT(end, '%T') as 'endet um', 
subject as 'betreff',
location as 'ort',
description as 'beschreibung',
cr.caption
FROM appointment
LEFT JOIN appointment_resource ar ON ar.appointment_id = appointment.id
LEFT JOIN calendar_resource cr ON cr.id = ar.resource_id
INNER JOIN instance_properties ip ON ip.object_id = appointment.id AND ip.instance_id = 4
WHERE
appointment.private = 0 AND appointment.recurrence_type = 0 AND ip.deleted = 0

Alle Kontakte löschen

z.B. nach einem fehlgeschlagenen Kontaktimport

Code Block
languagesql
DELETE FROM instance_properties WHERE instance_id=1;
DELETE FROM link WHERE instance_id1=1 OR instance_id2=1;
DELETE FROM links WHERE instance_id1=1 OR instance_id2=1;
DELETE FROM tlstatus WHERE instance_id=1;
DELETE FROM instance_properties_attachments where addin_id=1;
DELETE FROM contact;
DELETE FROM `contact-group`;

Alle Emails aus antony und dem Dateisystem löschen (über Navicat und Powershell)

  1. Pfade im Dateisystem aus Datenbank holen und das Ergebniss in einem administrativen Powershell-Fenster ausführen

    Code Block
    languagesql
    select CONCAT("Remove-item \'", SUBSTRING(guid, 1, 2), "/", SUBSTRING(guid, 3, 2) , "/", REPLACE( SUBSTRING(guid, 5), "-", "/"), "/\' -Recurse -Force")
    FROM instance_properties_attachments
    WHERE addin_id=3
  2. Daten aus Datenbank löschen

    Code Block
    languagesql
    DELETE FROM email_messages;
    DELETE FROM email_addresses;
    DELETE FROM `email_message-email_account`;
    DELETE FROM instance_properties WHERE instance_id=3;
    DELETE FROM tlstatus WHERE instance_id=3;
    DELETE FROM instance_properties_attachments where addin_id=3

Alle Termine aus antony löschen (über Navicat)

...

Code Block
languagesql
DELETE FROM appointment;
DELETE FROM appointment_reminders;
DELETE FROM appointment_resource;
DELETE FROM instance_properties WHERE instance_id=4;
DELETE FROM tlstatus WHERE instance_id=4;
DELETE FROM instance_properties_attachments where addin_id=4;

Nach E-Mail-Import aus Outlook die E-Mail-Datumfelder korrigieren

Note

ACHTUNG:
Dieses Vorgehen in der Datenbank nach einem Import ist nur bei den “alten” Importern nötig.
Die neuen (ab antony Version > *.22.150) wird das bereits beim Import korrekt eingefügt.

Die UserId des Admins ist in den Queries notwendig, um zwischen importierten E-Mails und regulär, abgeholten E-Mails zu unterscheiden

Code Block
breakoutModewide
languagesql
UPDATE
email_messages
    INNER JOIN instance_properties ON instance_properties.instance_id = 3 AND instance_properties.object_id = email_messages.id
    AND instance_properties.direction = 2
SET instance_properties.object_date = email_messages.delivery_date WHERE instance_properties.created_by_userid = 2 --das ist die ID des Admins
Code Block
breakoutModewide
languagesql
UPDATE
	tlstatus
		INNER JOIN instance_properties ON 
			instance_properties.instance_id = tlstatus.instance_id and 
			tlstatus.instance_id=3  AND 
			instance_properties.object_id = tlstatus.object_id AND 
			instance_properties.direction = 2 AND
			tlstatus.is_resubmission=0 AND -- nicht wiedervorlegt
			tlstatus.resubmission_date is null AND -- keine wiedervorlage eingerichtet
			tlstatus.is_globalize=0 AND  -- nicht geteilt
			instance_properties.chatsession_id=0 -- nicht geteilt
 
SET tlstatus.resubmission_sort_date = instance_properties.object_date