Re: Time difference for a query by changing one field?
Posted by: Goerge Meier
Date: November 20, 2018 08:59AM

Hello Peter,
SQL Version 14.14 Distrib 5.5.55 readline 6.3
Example is:
id 	Name mtime 	lat 	lon 	Speed 	note
1009854 Mike 2018-11-20 15:44:48 	41.3583 	6.63904 	0 	(3)
and 12 rows like this with other Names

And the structure:
CREATE TABLE `DBLoc` (
  `id` int(11) NOT NULL,
  `Name` varchar(15) COLLATE utf8_bin NOT NULL DEFAULT '',
  `Datum` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `lat` decimal(15,11) NOT NULL,
  `lon` float(15,11) NOT NULL,
  `Speed` decimal(5,0) NOT NULL DEFAULT '0',
  `mtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `akku` int(3) NOT NULL,
  `note` varchar(500) COLLATE utf8_bin NOT NULL,
  `distanz` decimal(9,3) NOT NULL,
  `park` int(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

ALTER TABLE `DBLoc`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `Name` (`Name`,`Datum`);

ALTER TABLE `DBLoc`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

Last one helps little. Maybe it has to do with datum is a unique keyfield?

Peter Brawley Wrote:
-------------------------------------------------------
> To avoid guesses, let's see the MySQL version, the
> Explain result for the query inside BBCode code
> tags, and Show Create Table results for each
> table.

Options: ReplyQuote


Subject
Written By
Posted
Re: Time difference for a query by changing one field?
November 20, 2018 08:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.