使用另一列的字符串变量创建MySQL列,再加上其他信息 [英] Create MySQL column with string variable from another column, plus additional information
本文介绍了使用另一列的字符串变量创建MySQL列,再加上其他信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如
我可以在表中添加一个包含docID的列,再加上一堆静态信息, p>
For example
docID | topic | docURL
________________________________________________________
1 | Floods | http://site.com/downloaddoc.php?docID=1
2 | Etc.. | http://site.com/downloaddoc.php?docID=2
我知道这似乎很复杂这样做,但是我们必须将这个特定的表格可以下载到CSV中,将数据导入使用Excel作为输入的其他程序。
I know it seems convoluted to do it this way, but we have to have this particular table downloadable into a CSV to import the data into other programs that use Excel as an input.
推荐答案
您可以尝试这样:
CREATE TRIGGER upd BEFORE INSERT ON table
FOR EACH ROW
BEGIN
SET NEW.docURL = CONCAT('http://site.com/downloaddoc.php?docID=',NEW.docID);
END;
这篇关于使用另一列的字符串变量创建MySQL列,再加上其他信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文