# Tree

Query:
SELECT ID, ' ' AS ' ', IIF(Len(LastName & FirstName)=0 OR ISNULL(LastName & FirstName), Company, LastName & ' ' & FirstName) AS Name, * FROM Contacts ORDER BY LastName & FirstName


Query:
SELECT ID, '' AS '',  IIF(ContactID = 0,Subject,  'Звонок: ' &  (SELECT IIF(Len(LastName & FirstName)=0 OR ISNULL(LastName & FirstName), Company, LastName & ' ' & FirstName) AS Name FROM Contacts WHERE ID=ContactID)) AS Event, CStr([Date]) AS Begin, StartTime, * FROM Calendar WHERE NOT IsNull([Date]) ORDER BY [Date], StartTime


Query:
SELECT ID, '' AS '',  Subject AS Event, CStr([Date]) AS Begin, StartTime, * FROM Calendar WHERE NOT IsNull([Date]) AND EventType = 0 ORDER BY [Date], StartTime


Query:
SELECT ID, '' AS '',  Subject AS Event, CStr([Date]) AS Begin, StartTime, * FROM Calendar WHERE NOT IsNull([Date]) AND EventType = 2 ORDER BY [Date], StartTime


Query:
SELECT ID, '' AS '',  'Звонок: ' &  (SELECT IIF(Len(LastName & FirstName)=0 OR ISNULL(LastName & FirstName), Company, LastName & ' ' & FirstName) AS Name FROM Contacts WHERE ID=ContactID) AS Event, CStr([Date]) AS Begin, StartTime, * FROM Calendar WHERE NOT IsNull([Date]) AND EventType = 3 ORDER BY [Date], StartTime


Query:
SELECT ID, '' AS '',  Subject AS Event, CStr([Date]) AS Begin, StartTime, * FROM Calendar WHERE NOT IsNull([Date]) AND EventType <> 3 AND EventType <> 0 AND EventType <> 2 ORDER BY [Date], StartTime


Query:
SELECT ID, ' ' AS ' ', IIF(ContactID = 0,Subject,  'Звонок: ' &  (SELECT IIF(Len(LastName & FirstName)=0 OR ISNULL(LastName & FirstName), Company, LastName & ' ' & FirstName) AS Name FROM Contacts WHERE ID=ContactID)) AS Task, * FROM Tasks ORDER BY Subject


Query:
SELECT ID, ' ' AS ' ', ID, Name, Number, * FROM Sim_main ORDER BY Name


Query:
SELECT ID, ' ' AS ' ', ID, Name, Number FROM Sim_main ORDER BY ID


Query:
SELECT ID, ' ' AS ' ', Name, Number FROM Sim_dialed ORDER BY Name


Query:
SELECT ID, ' ' AS ' ', Name, Number FROM Sim_received ORDER BY Name


Query:
SELECT ID, ' ' AS ' ', Name, Number FROM Sim_missed ORDER BY Name


Query:
SELECT ID, ' ' AS ' ', Number FROM Sim_own ORDER BY Name


Query:
SELECT ID, ' ' AS ' ', Name, [Date], * FROM Sms ORDER BY Name


Query:
SELECT ID, ' ' AS ' ', Name, [Date], * FROM Sms WHERE Category= 0 ORDER BY [Date] DESC


Query:
SELECT ID, ' ' AS ' ', Name, [Date], * FROM Sms WHERE Category= 1 ORDER BY [Date] DESC


Query:
SELECT ID, ' ' AS ' ', Name, [Date], * FROM Sms WHERE Category= 2 ORDER BY [Date] DESC


Query:
SELECT ID, ' ' AS ' ', Name, [Date], * FROM Sms WHERE Category= 3 ORDER BY [Date] DESC


Query:
SELECT ID, ' ' AS ' ', Name, [Date], * FROM Sms_arch ORDER BY ID DESC


