wiki:sysadminModifyingUsers

Modifying user attributes

A quick example of how to update a user's main profile via the magic of SQL :)

BEGIN;

-- Grabbing the IDs for the Reader (14) and Undergraduate (13)
-- from actor.usr and home_ou from actor.org_unit (OWA = 109, OWAL = 122)
UPDATE actor.usr 
SET profile = 13 
WHERE profile = 14 AND home_ou IN (109, 122);

-- or via a sub-select
UPDATE actor.usr 
SET profile = 13
WHERE profile = 14 AND home_ou IN (
	SELECT aou.id 
	FROM actor.org_unit aou 
	WHERE shortname IN ('OWA', 'OWAL')
);
Last modified 14 years ago Last modified on Jul 29, 2009, 11:45:01 AM

Attachments (1)

Download all attachments as: .zip