Re: LAST_INSERT_ID and CRC32

2009-05-05 Thread thun...@isfahan.at
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 wrote: Johnny Withers schr

Re: LAST_INSERT_ID and CRC32

2009-05-05 Thread Johnny Withers
Yes, Triggers... I so rarely use them I forget they exist. On Tue, May 5, 2009 at 10:22 AM, Thomas Pundt 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

Re: LAST_INSERT_ID and CRC32

2009-05-05 Thread Thomas Pundt
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 crcva

Re: LAST_INSERT_ID and CRC32

2009-05-03 Thread Johnny Withers
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 crcval column. On Sunday, Ma

Re: LAST_INSERT_ID and CRC32

2009-05-03 Thread thun...@isfahan.at
I'm so sorry for the mistake... I mean: I think it is to slow when I make a SELECT later in this form: I don't think its possible to do what you want in a single statement. Since LAST_INSERT_ID() is set to the last insert id of the connection... and the row you are inserting doesn't exist.. wel

Re: LAST_INSERT_ID and CRC32

2009-05-03 Thread thun...@isfahan.at
Hi Johnny, I need the CRC32 for a unique URL-ID... I think it isn't to slow when I make a SELECT later in this form: Rows in Table: 825,984 Search for id: 2532552 (CRC32: 46316330) SELECT id FROM `testtable` WHERE id = "2532552" 0.0005 sec. SELECT id FROM `testtable` WHERE CRC32(id) = "46316

Re: LAST_INSERT_ID and CRC32

2009-05-03 Thread Johnny Withers
I don't think its possible to do what you want in a single statement. Since LAST_INSERT_ID() is set to the last insert id of the connection... and the row you are inserting doesn't exist.. well.. until you create it, it will always either be zero or the record BEFORE your next insert, ie: INSERT I

LAST_INSERT_ID and CRC32

2009-05-03 Thread thun...@isfahan.at
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`) ) ENGIN