List:General Discussion« Previous MessageNext Message »
From:thunder@isfahan.at Date:May 3 2009 12:16pm
Subject:LAST_INSERT_ID and CRC32
View as plain text  
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`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


`id` is the unique autoincrement

in `id-crc` I would like save the CRC32 from `id` (the coloumn is unique)

E.G.

id	id-crc
--------------------
1	2212294583	--> CRC32('1')
2	450215437	--> CRC32('2')
3	1842515611	--> CRC32('3')

I would like insert the CRC32 directly when I make a new Insert. E.G.

INSERT INTO `db283796092`.`testtable` 
(
`id` , `id-crc`
)
VALUES (
NULL , LAST_INSERT_ID()
);

But LAST_INSERT_ID() is 0!!!! How can I make that, that he use the actual INSERT-ID?

Best regards

Thunder





 



Thread
LAST_INSERT_ID and CRC32thunder@isfahan.at3 May
  • Re: LAST_INSERT_ID and CRC32Johnny Withers3 May
    • Re: LAST_INSERT_ID and CRC32thunder@isfahan.at3 May
      • Re: LAST_INSERT_ID and CRC32Johnny Withers4 May
        • Re: LAST_INSERT_ID and CRC32Thomas Pundt5 May
          • Re: LAST_INSERT_ID and CRC32Johnny Withers6 May
            • Re: LAST_INSERT_ID and CRC32thunder@isfahan.at6 May
    • Re: LAST_INSERT_ID and CRC32thunder@isfahan.at3 May