I'm trying to create a temporary login link URI to be used to gain "viewable" access to a secured area using mysql alone. The idea is to set the value of a field to a given sha1 value.
The sha1 value would be determined by concatenating a couple of random fields and a salt. (I'm not sure if this is good practice)
The following returns an syntax error which I'm fairly sure is to do with using the same table name in the subquery. Is there a sensible way to achieve this? I'm able to do this in PHP, but I'm trying to develop my own SQL skills.
Any recommendations on 'best practice' also appreciated.
update rsvp set rsvp.rsvpViewHash = sha1(select sha1(concat(rsvp.rsvpURLSlug, rsvp.rsvpCreated, 'salt')) from rsvp);