【发布时间】:2022-01-31 08:17:53
【问题描述】:
我有一个包含这些字段的数据库:
picture_id - (varchar) generally the actual filename of the picture (ie. myfile001.jpg)
event - (varchar) string describing the event (ie. Bob's Wedding 2005)
date_of_picture - (varchar) string representing a date (ie. 2004.01.45, Jan 2004, Summer 1969, etc)
filename - (text) - the full path to the picture, including the filename (ie. /pics/bob/2005/wedding)
我现在需要更改一些文件名条目。
有没有一种方法可以查询事件并使用生成的图片 ID 来更新文件名?
类似:
select picture_id as picid from photos where
event='Bob's Wedding 2005' update set filename='/my/new/path/here/$picid'
任何给定事件都可能有 100 个图片 ID。
我不是DBA,这只是我个人使用的简单数据库,所以如果我的问题不清楚或者我的数据库结构完全是业余的,请原谅我。
【问题讨论】:
标签: mysql select sql-update