Thank you very much for all answers
I will trying Triggers and the example with the update after an INSERT.
Ant then, I use the best for me;-)
Thunder
Yes, Triggers... I so rarely use them I forget they exist.
On Tue, May 5, 2009 at 10:22 AM, Thomas Pundt mli...@rp-online.de wrote:
Johnny Withers schrieb:
Well, I think an update after insert is the only way. Other than
perpopulating another table with possibe crc values then usinga join:
Select id from testtable
Inner join crctable on testtable.id=crctable.id
Where crctable.crcval='xxx'
Just be sure to index the
Yes, Triggers... I so rarely use them I forget they exist.
On Tue, May 5, 2009 at 10:22 AM, Thomas Pundt mli...@rp-online.de wrote:
Johnny Withers schrieb:
Well, I think an update after insert is the only way. Other than
perpopulating another table with possibe crc values then usinga join:
Hello,
I have a questions and I hope, that is possible in MySQL.
I have the following short Table.
CREATE TABLE IF NOT EXISTS `testtable` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`id-crc` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id-crc` (`id-crc`)
)
INTO testtable(NULL,LAST_INSERT_ID());
INSERT INTO testtable(NULL,LAST_INSERT_ID());
would produce
IDCRC32ID
1 0
2 1
You could run an update immediately after the insert to set the CRC32
column:
UPDATE testtable SET id-crc=CRC32(LAST_INSERT_ID()) WHERE
id=LAST_INSERT_ID
1
You could run an update immediately after the insert to set the CRC32
column:
UPDATE testtable SET id-crc=CRC32(LAST_INSERT_ID()) WHERE
id=LAST_INSERT_ID();
Not quite sure why you need the CRC32 value of the ID, will it not always be
the same value for the given ID number? Wouldn't it be easier
to set the CRC32
column:
UPDATE testtable SET id-crc=CRC32(LAST_INSERT_ID()) WHERE
id=LAST_INSERT_ID();
Not quite sure why you need the CRC32 value of the ID, will it not always be
the same value for the given ID number? Wouldn't it be easier to do it on
the select side of the equation?
SELECT id
(NULL,LAST_INSERT_ID());
would produce
ID CRC32ID
1 0
2 1
You could run an update immediately after the insert to set the CRC32
column:
UPDATE testtable SET id-crc=CRC32(LAST_INSERT_ID()) WHERE
id=LAST_INSERT_ID();
Not quite sure why you need the CRC32 value of the ID