另一个子查询是否有可能从同一个表日期明智的记录得到如下结果:Ading在现有子查询
Enrolled Enrolled as Email Enrolled as Text Deals Redeemed
<First Date> 7 5 2 6
<Next Date> 9 3 6 14
表结构是这个样子:
Customer_id, field1, field2, responsecode, created_date
我当前的查询是这样的:
select created_date,
count(field1) Enrolled,
count(case field1 when 'E-mail' then 1 end) Enrolled_as_Email,
count(case field1 when 'Cell Phone' then 1 end) Enrolled_as_Cell,
count(responsecode) Deals_Redeemed
from tblCustomer
group by created_date
order by created_date
这对于前三列,但对日工作正常e四列是“Deals redeemed”,这是来自另一个表的子查询。
Select COUNT(*) from tbl_TransactionDishout where DishoutResponseCode = '0000'
表结构如下:
表名是 “tbl_TransactionDishout”
[Trnx_ID] [int] IDENTITY(1,1) NOT NULL,
[OfferNo] [nvarchar](50) NULL,
[MerchantID] [nvarchar](50) NULL,
[TerminalID] [nvarchar](50) NULL,
[DishoutResponseCode] [nvarchar](50) NULL,
[Created] [datetime] NULL
什么是tblCustomer和tbl_TransactionDishout之间的关系?它是否为DishoutResponseCode的响应码? – arunes 2012-03-01 07:11:08
它们之间没有任何关系..我只希望结果以日期顺序显示.. – 2012-03-01 07:14:16