Diferencia entre revisiones de «Queries»
De wiki
(Página creada con «== Todas las notas y tareas == Notas <pre> SELECT Thingy.createdOn AS noteCreatedOn, Thingy.createdBy AS noteCreatedBy, Note.description AS noteDescription, ...») |
Revisión de 12:41 6 oct 2014
Todas las notas y tareas
Notas
SELECT Thingy.createdOn AS noteCreatedOn, Thingy.createdBy AS noteCreatedBy, Note.description AS noteDescription, COALESCE(Contact.name, TRIM(CONCAT(Contact.firstName,' ',Contact.lastName))) AS noteReferenceContact FROM Note JOIN Thingy ON Note.id = Thingy.id JOIN ThingyRelation ON Note.id = ThingyRelation.fromId AND ThingyRelation.code = '@' JOIN Contact ON ThingyRelation.toId = Contact.id
Tareas
SELECT Thingy.createdOn AS taskCreatedOn, Thingy.createdBy AS taskCreatedBy, Task.due AS taskDue, Task.completed AS taskCompleted, Task.supervised AS taskSupervised, Task.description AS noteDescription, COALESCE(Contact.name, TRIM(CONCAT(Contact.firstName,' ',Contact.lastName))) AS noteReferenceContact FROM Task JOIN Thingy ON Task.id = Thingy.id JOIN ThingyRelation ON Task.id = ThingyRelation.fromId AND ThingyRelation.code = '@' JOIN Contact ON ThingyRelation.toId = Contact.id