I've seen examples using crc, but the examples I've got my head round work with generating a checksum for entire table data (for use with replication and data validation). For example:
SELECT crc
FROM
(
SELECT @r := MD5(CONCAT(property_id, asking_price, postcode,
address_city, @r)) AS crc,
@c := @c + 1 AS cnt
FROM
(
SELECT @r := '', @c := 0
) rc,
(
SELECT property_id, asking_price, postcode, address_city
FROM table
WHERE property_type_id = 2
AND listing_type = 'BUY'
ORDER BY
address_postalcode
) k
) ci
WHERE cnt = @c
I'm trying to assign a checksum value to each entry in a MYSQL database, based on a series of field values (shown above). The idea being that when a specific set of fields have the same data in, the checksum generated would be the same and I can deal with duplicate entries by checking the checksum value, instead of lengthy checks of the field to see if they contain matching data. I've seen this in SQL SERVER, using checksum_binary, which is so fast but is there a better solution to apply a checksum value to individual fields for comparison or should I stick with trying to modify the above?