Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 05-23-2012, 01:46 PM   #1
Just Alex
Liv Benson to You, Bitch
 
Just Alex's Avatar
 
Industry Role:
Join Date: Aug 2007
Location: Maryland and WV
Posts: 6,060
SQL experts, can you please help.

Ok, so I have primary key thats AUTO_INCREMENT. There's another field file_name that I need to populate with number from primary key plus file extension

So right now its like this and I need to run an update query to populate file_name fields

File_Id File_name
1 NULL
2 NULL
3 NULL


To be


File_Id File_name
1 1.jpg
2 2.jpg
3 3.jpg

What's correct structure of update query?

Thank you

__________________
Just Alex is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-23-2012, 02:10 PM   #2
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
UPDATE table SET File_name = CONCAT( File_id, '.jpg' );
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-23-2012, 02:13 PM   #3
Just Alex
Liv Benson to You, Bitch
 
Just Alex's Avatar
 
Industry Role:
Join Date: Aug 2007
Location: Maryland and WV
Posts: 6,060
Quote:
Originally Posted by Brujah View Post
UPDATE table SET File_name = CONCAT( File_id, '.jpg' );
Huh, it worked. Im so stupid adding convert(varchar(100) to this thinking numeric field cant be concatenated in text fields.

Thank you very much!
__________________
Just Alex is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.