站内搜索

SQL多行字符串按条件合并_MySQL

USE [ARTEA.MES]GO/****** Object: UserDefinedFunction [dbo].[UnionPart] Script Date: 11/18/2015 15:39:34 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author:  <Author,,Name>-- Create date: <Create Date, ,>-- Description: <Description, ,>-- =============================================ALTER FUNCTION [dbo].[UnionPart](-- Add the parameters for the function here@OrderNo varchar(30))RETURNS [nvarchar](4000)ASBEGIN-- Declare the return variable hereDECLARE @ReturnValue [nvarchar](4000)SET @ReturnValue = ''-- Add the T-SQL statements to compute the return value hereSELECT @ReturnValue=@ReturnValue + RTRIM(LTRIM(c.PartName)) + ','FROM table1 c left join table2 d on d.OrderID=c.OrderIDWHERE d.OrderNO = @OrderNoSET @ReturnValue = substring(@ReturnValue,1,len(@ReturnValue)-1)RETURN @ReturnValueENDGO
  • 上一篇:SQLite 授权动作编码(AuthorizerAction Codes)_MySQL
  • 下一篇:我们分组玩的游戏 还记得吗_MySQL