我正在尝试将SQL查询结果捕获到表中。查询工作正常,没有围绕它的代码将其捕获到表中但我在#39;附近得到语法错误。任何帮助将不胜感激。
Select *
Into #TempTable
From
(Select
SUM ([Total Messages]) as WTMT ,
SUM ([Messages Below Threshold]) as [Weekly Messages Below Threshold],
SUM ([Average Time (Sec )]) as [Weekly Average Delivery Time],
(SUM ([Total Messages])- SUM ([Messages below threshold]))
As [Weekly Messages Above Threshold]
from [Weekly Mail Delivery Times ByServer])
答案 0 :(得分:2)
我建议在查询中添加别名:
SELECT * INTO #TempTable FROM(SELECT SUM([Total Messages]) AS WTMT, SUM([低于阈值的消息])AS [每周消息低于阈值], SUM([平均时间(秒)])AS [每周平均交货时间], (SUM([消息总数]) - SUM([消息低于阈值]))AS [超过阈值的每周消息] FROM [每周邮件传递时间ByServer] )AS t
答案 1 :(得分:2)
其中任何一个都可以使用
Select *
Into #TempTable
From (
Select SUM ([Total Messages]) as WTMT ,
SUM ([Messages Below Threshold]) as [Weekly Messages Below Threshold],
SUM ([Average Time (Sec )]) as [Weekly Average Delivery Time],
(SUM ([Total Messages])- SUM ([Messages below threshold])) As [Weekly Messages Above Threshold]
from [Weekly Mail Delivery Times ByServer]
) As X
或
Select SUM ([Total Messages]) as WTMT ,
SUM ([Messages Below Threshold]) as [Weekly Messages Below Threshold],
SUM ([Average Time (Sec )]) as [Weekly Average Delivery Time],
(SUM ([Total Messages])- SUM ([Messages below threshold])) As [Weekly Messages Above Threshold]
Into #TempTable
from [Weekly Mail Delivery Times ByServer]
答案 2 :(得分:1)
您的派生表需要别名:
public class MyImageTextView extends View {
String textOnImage;
Bitmap bitmapBackground;
public MyImageTextView(Context context) {
super(context);
init();
}
public MyImageTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MyImageTextView(Context context, AttributeSet attrs, int defStyleAttr)
{
super(context, attrs, defStyleAttr);
init();
}
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
int centerx = getWidth() / 2;
int centery = getHeight() / 2;
canvas.drawBitmap(bitmapBackground, 0, 0, null);
drawText(canvas, centerx , centery , textOnImage)
}
public void drawText(Canvas canvas, float x, float y, String text) {
int consumedCalTextSize = getResources().getDimensionPixelSize(R.dimen.food_circular_graph_text_size);
Paint canvasTextPaint = new Paint();
canvasTextPaint.setAntiAlias(true);
canvasTextPaint.setARGB(255, 255, 255, 255);
canvasTextPaint.setTextSize(consumedCalTextSize);
canvasTextPaint.setTextAlign(Paint.Align.CENTER);
canvas.drawText(text, x, y, canvasTextPaint);
}
}