使用mysql在select query语句中创建一个href链接?

时间:2016-10-19 12:50:16

标签: mysql

我需要知道可以使用mysql在select query语句中创建一个href链接。

select '<a href=$site_URL/index.php?module=xxxxxx&view=Detail&record=a.mcaid>a.mcaid</a>' as dba,account_number as `account number` ,rate as split, CAST((-total_amount)/100 as DECIMAL(10,2)) as `total amount`, CAST((-withdrawal_amount)/100 as DECIMAL(10,2)) as `withdrawal amount`,  DATE_FORMAT(start_date, '%m-%d-%Y') as `start date`,concat(name,'  ' ,a.mcaid) as mca  from fdr_me_daily_activity inner join vtiger_mcacf a on cf_1440=account_number  inner join vtiger_mca b
on b.mcaid=a.mcaid INNER JOIN vtiger_crmentity on a.mcaid=vtiger_crmentity.crmid where vtiger_crmentity.deleted=0 order by start_date desc  limit  0 , 50"

所以这是我的查询,我想将所选列传递给href链接

<a href=$site_URL/index.php?module=xxxxxx&view=Detail&record=a.mcaid>**a.mcaid**</a> ;

a.mcaid - 我无法将列传递到href中。所以,请你能帮助我。

我不想使用php。

此致 Nandhagopal J

1 个答案:

答案 0 :(得分:1)

使用Concat加入值。

select CONCAT('<a href=$site_URL/index.php?module=xxxxxx&view=Detail&record=a.mcaid>',a.mcaid,'</a>') as dba,account_number as `account number` ,rate as split, CAST((-total_amount)/100 as DECIMAL(10,2)) as `total amount`, CAST((-withdrawal_amount)/100 as DECIMAL(10,2)) as `withdrawal amount`,  DATE_FORMAT(start_date, '%m-%d-%Y') as `start date`,concat(name,'  ' ,a.mcaid) as mca  from fdr_me_daily_activity inner join vtiger_mcacf a on cf_1440=account_number  inner join vtiger_mca b
on b.mcaid=a.mcaid INNER JOIN vtiger_crmentity on a.mcaid=vtiger_crmentity.crmid where vtiger_crmentity.deleted=0 order by start_date desc  limit  0 , 50"

我希望这对你有用。