Hallo,
hab ein Problem mit Log-Tabellen. Hier ein Auszug:
Ich möchte gern eine Abfrage wo man das erste und das letzte Auftreten von "time" in Kombination mit GROUP erhalten kann. Beispiel:
Indizes sind über id, log_id, id_service und time.
Ist das überhaupt machbar?
hab ein Problem mit Log-Tabellen. Hier ein Auszug:
Code:
INSERT INTO `portal_geo_log` (`id`, `log_id`, `log_type`, `code`, `subcode`, `id_service`, `id_layer`, `year`, `month`, `day`, `hour`, `minute`, `time`) VALUES (22686, NULL, 'validate', 12288, NULL, 50, '[Wasserkraftanlagen]', 2012, 10, 2, 17, 14, '2012-10-02 17:14:09');
INSERT INTO `portal_geo_log` (`id`, `log_id`, `log_type`, `code`, `subcode`, `id_service`, `id_layer`, `year`, `month`, `day`, `hour`, `minute`, `time`) VALUES (28346, NULL, 'validate', 12288, NULL, 50, '[Wasserkraftanlagen]', 2012, 10, 2, 19, 12, '2012-10-02 19:12:11');
INSERT INTO `portal_geo_log` (`id`, `log_id`, `log_type`, `code`, `subcode`, `id_service`, `id_layer`, `year`, `month`, `day`, `hour`, `minute`, `time`) VALUES (96189, NULL, 'validate', 12288, NULL, 50, '[Wasserkraftanlagen]', NULL, NULL, NULL, NULL, NULL, '2012-10-04 17:40:06');
INSERT INTO `portal_geo_log` (`id`, `log_id`, `log_type`, `code`, `subcode`, `id_service`, `id_layer`, `year`, `month`, `day`, `hour`, `minute`, `time`) VALUES (96284, NULL, 'validate', 12288, NULL, 50, '[Wasserkraftanlagen]', NULL, NULL, NULL, NULL, NULL, '2012-10-04 18:05:06');
INSERT INTO `portal_geo_log` (`id`, `log_id`, `log_type`, `code`, `subcode`, `id_service`, `id_layer`, `year`, `month`, `day`, `hour`, `minute`, `time`) VALUES (88343, NULL, 'validate', 12288, NULL, 50, '[Wasserkraftanlagen]', 2012, 10, 3, 17, 25, '2012-10-03 17:25:06');
INSERT INTO `portal_geo_log` (`id`, `log_id`, `log_type`, `code`, `subcode`, `id_service`, `id_layer`, `year`, `month`, `day`, `hour`, `minute`, `time`) VALUES (93890, NULL, 'validate', 12288, NULL, 50, '[Wasserkraftanlagen]', 2012, 10, 3, 19, 24, '2012-10-03 19:24:06');
INSERT INTO `portal_geo_log` (`id`, `log_id`, `log_type`, `code`, `subcode`, `id_service`, `id_layer`, `year`, `month`, `day`, `hour`, `minute`, `time`) VALUES (39542, NULL, 'validate', 12288, NULL, 50, '[Wasserkraftanlagen]', 2012, 10, 2, 23, 11, '2012-10-02 23:11:11');
INSERT INTO `portal_geo_log` (`id`, `log_id`, `log_type`, `code`, `subcode`, `id_service`, `id_layer`, `year`, `month`, `day`, `hour`, `minute`, `time`) VALUES (33951, NULL, 'validate', 12288, NULL, 50, '[Wasserkraftanlagen]', 2012, 10, 2, 21, 11, '2012-10-02 21:11:11');
Code:
log_id=NULL
log_type=validate
code=12288
subcode=NULL
id_service=50
id_layer=Wasserkraftanlagen
time_first=2012-10-02 17:14:09
time_last=2012-10-02 21:11:11
Indizes sind über id, log_id, id_service und time.
Ist das überhaupt machbar?