4 Aprili 2006

Gonzo SQL statement

One of the nice things about the LazyWeb is that there are people on it with a lot more SQL-fu than I have. To fix yesterday’s primary-bitstream problem, find the bitstream’s ID as discussed in step 1 yesterday, and then do this (again, pretend the bitstream ID is 987 and the handle is 0000/72):

update bundle set primary_bitstream_id = 987
   where bundle_id in
      (select bundle_id from item2bundle
         where item_id =
            (select resource_id from handle where handle='0000/72'))
      and name = "ORIGINAL";

See? Nothing to it. And thanks to the person who kindly lent me some fu.