Jump to content

SQL field addon


dennismonsewicz

Recommended Posts

I suppose:

 

Here is a better example

 

I am trying to track down everyone who downloads a file and dump their username into a database. And I don't want the names to be updated so that they are erased.

 

If you have user1 in your database and user2 downloads the file, is there a way to add user2 in the same row as user1?

Link to comment
Share on other sites

OK, let me try, I don't know the names of your fields so I'll make em up.

 

insert into tablename (field1, field2, field3, username) values select field1, field2, field3, "2ndUser" from tablename where usnername = "1stuser"

 

I don't have a database in front of me right now, but you may or may not need the values clause.

Let me know if this helps, I may have the sytax messed up a bit, but the concept is there.

Link to comment
Share on other sites

Let me try one last time (username field already has user1 as downloading this file)

You could also choose a delimiter to place between the user names

 

update tablename 
        set username = concat(username, "user2")
        where filename = "Thedownloadfile.txt";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.