我想在特定的月份和年份列显示这些记录,如下表格式
int ith(unsigned long x, int i)
{
int count=0;
unsigned long y = x;
do
{
y /= 10;
count++;
} while (y > 0);
if (i > count)
return -1;
count -= i;
while (count > 0)
{
x /= 10;
count--;
}
return x % 10;
}
以下是样本日期
count==54353453
答案 0 :(得分:0)
在Sql Server中,您可以Cross Apply
与Tabled Valued Constructor
一起使用以取消数据
SELECT cs.Source,
cs.Total
FROM tbl_leads
CROSS apply (VALUES ('Organic',Organic),
('Paid',Paid),
('EmailCampaign',EmailCampaign),
('Total',Total)) cs(Source, Total)
WHERE Month = 'Aug'
AND Year = '2015'
或Generic Sql解决方案
SELECT 'Organic' AS Source,
Organic AS Total
FROM tbl_leads
UNION ALL
SELECT 'Paid',
Paid
FROM tbl_leads
UNION ALL
SELECT 'EmailCampaign',
EmailCampaign
FROM tbl_leads
UNION ALL
SELECT 'Total',
Total
FROM tbl_leads