sql database splicing two or more field values Code

Copyright: without her consent, and not to reprint the article, if reproduced please note the link address! https://blog.csdn.net/qq_38366657/article/details/89882544
//之间不加空格的:concat(ES.NOTICE_ID,ES.DEPT_ID)
select PUB.BILL_ID AS COUNT,ES.DEPT_NAME from ES_NOTICE_TARGET ES JOIN PUB_FILES PUB ON PUB.BILL_ID=concat(ES.NOTICE_ID,ES.DEPT_ID) GROUP BY PUB.BILL_ID ,ES.DEPT_NAME 
//加空格或者其他的: concat(concat(ES.NOTICE_ID,''),ES.DEPT_ID)
 select PUB.BILL_ID AS COUNT,ES.DEPT_NAME from ES_NOTICE_TARGET ES JOIN PUB_FILES PUB ON PUB.BILL_ID=concat(concat(ES.NOTICE_ID,''),ES.DEPT_ID) GROUP BY PUB.BILL_ID ,ES.DEPT_NAME 

 

Guess you like

Origin blog.csdn.net/qq_38366657/article/details/89882544