Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 如何将表数据作为预定义字符串中的变量返回-SQL_Mysql_Url_Dynamic_Concatenation - Fatal编程技术网

Mysql 如何将表数据作为预定义字符串中的变量返回-SQL

Mysql 如何将表数据作为预定义字符串中的变量返回-SQL,mysql,url,dynamic,concatenation,Mysql,Url,Dynamic,Concatenation,我希望使用数据库中的表数据生成URL列表。例如,如果我查询ORDERS表,我希望以URL形式返回该信息 e、 g.预定义字符串为“mysite.com/profile/orders/”,查询将输入ORDER\u ID以返回mysite.com/profile/orders/ORDER\u ID的最终结果 我希望这是有道理的。任何帮助都将受到真诚的感谢 使用连接: SELECT CONCAT('https://example.com/profile/orders/', order_id) AS o

我希望使用数据库中的表数据生成URL列表。例如,如果我查询ORDERS表,我希望以URL形式返回该信息

e、 g.预定义字符串为“mysite.com/profile/orders/”,查询将输入ORDER\u ID以返回mysite.com/profile/orders/ORDER\u ID的最终结果

我希望这是有道理的。任何帮助都将受到真诚的感谢

使用连接:

SELECT CONCAT('https://example.com/profile/orders/', order_id) AS order_url
FROM ORDERS
WHERE ...

这确实起了作用。非常感谢。如果这还不够明显的话,我对SQL游戏还是有点陌生。。