No announcement yet.

help with a query please

  • Filter
  • Time
  • Show
Clear All
new posts

  • help with a query please

    hi i was wondering if anyone can help me with this query
    i want to run

    i want to assign a profile to a usergroup please
    i think it will be something like this
    UPDATE usergroupid(9) SET profilefieldid(12) = option(2)

    but as im an amature i didnt want to run it without pros seeing it first

    basically i want to assign the second option of profileid12 to usergroupid 9
    im not sure if the second option would be 2 or 1 if 0 applies to the first blank

    any help will be greatfully recieved Admin

  • #2
    So you want to set the value of a profile field for users in a specific usergroup? Are these users primary or secondary members of the group? If they are primary members then this query will do it:

    UPDATE userfield LEFT JOIN user ON (user.userid = userfield.userid)
    SET fieldX = Y WHERE user.usergroupid = Z

    Where X is the number of the profile field, Y is the value of the field, and Z is the usergroupid of the group whose members you want to update.

    If you use table prefixes then you need to change each instance of userfield and user to include the prefix.

    If the profile field is a multiple selection field then see my post in this thread for help calculating the stored value. Otherwise just use the actual value you want to store. If the value is a text value then use quotes around the value in the query, like 'this'.


    • #3
      UPDATE userfield LEFT JOIN user ON (user.userid = userfield.userid)
      SET field12 = '' WHERE user.usergroupid = 9

      yes they are primary users of the group
      so the command above would put this value
      into the profile field12 for only the usergroupid9

      and would it then automatically do this from then
      or would i from then just do it manually each occation (this is fine) Admin


      • #4
        It won't automatically set that value for new users, you will have to manually update it.

        Don't forget to backup your database before querying it.


        • #5
          yes only just got it how i like it

          dont want to loose it now. the boss would kill me
          thanx 4 the help
          ill report results


          • #6

            Worked perfectly thank you your help

            if anyone else does this and need some quick pics to use
            in the field i made these
            nothing special but you may use them
            Attached Files