复制代码 代码如下:
CREATE TABLE [dbo].[CMPP_SendCentre] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[SendType] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[SendDate] [datetime] NOT NULL ,
[Port] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[Service_ID] [varchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[FeeType] [varchar] (2) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[FeeCode] [varchar] (6) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[Msg_Content] [varchar] (1024) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[SendCount] [int] NOT NULL ,
[SucceedCount] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[CMPP_SendCentreMo] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[SendCentreID] [int] NOT NULL ,
[Mo] [varchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[Stat] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
CMPP_SendCentreMo.SendCentreID 与CMPP_SendCentre.ID成外建关系
复制代码 代码如下:
CREATE VIEW dbo.ViewCMPP_SendCentreMo
AS
SELECT
dbo.CMPP_SendCentreMo.id,
dbo.CMPP_SendCentreMo.SendCentreID,
dbo.CMPP_SendCentreMo.Mo,
dbo.CMPP_SendCentreMo.Stat,
dbo.CMPP_SendCentre.SendType,
dbo.CMPP_SendCentre.SendDate,
dbo.CMPP_SendCentre.Port,
dbo.CMPP_SendCentre.Service_ID,
case dbo.CMPP_SendCentre.FeeType when '01' then '免费' when '02' then '点播' else '包月' end as FeeType,
cast(dbo.CMPP_SendCentre.FeeCode as smallint) as FeeCode,
dbo.CMPP_SendCentre.Msg_Content
FROM dbo.CMPP_SendCentre INNER JOIN
dbo.CMPP_SendCentreMo ON
dbo.CMPP_SendCentre.id = dbo.CMPP_SendCentreMo.SendCentreID
复制代码 代码如下:
select top 6*from [ViewCMPP_SendCentreMo]
where SendType = '扣费'
order by id desc
复制代码 代码如下:
select top 6*from [ViewCMPP_SendCentreMo]
where SendType = '扣费'
order by SendCentreID desc, id desc
新闻热点
疑难解答