我使用以下查询:
SELECT TRUNC (funddate, 'DD') "DATE",
NVL(SUM (amount),0) "TOTAL AMOUNT FUNDED PER DAY"
FROM purchases
WHERE empid= 1234 AND amount < 0
GROUP BY TRUNC (funddate, 'DD');
它给我的数据如下:
4/24/2017 -1255.32
4/26/2017 -430.36
4/28/2017 -189.92
但我希望数据显示如下:
4/24/2017 -1255.32
4/25/2017 0
4/26/2017 -430.36
4/27/2017 0
4/28/2017 -189.92
我想显示日期,并且没有购买任何一天的$ 0。
由于
答案 0 :(得分:1)
问题是,如果public class MainActivity extends AppCompatActivity {
EditText editText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText = (EditText) findViewById(R.id.editText);
}
public void buttonClick(View view) {
Layout layout = editText.getLayout();
for (int i = 0; i < layout.getLineCount(); i++) {
int baseline = layout.getLineBaseline(i);
Log.i("TAG", "line " + i + " baseline: " + baseline);
}
for (int i = 0; i < layout.getLineCount(); i++) {
int descent = layout.getLineDescent(i);
Log.i("TAG", "line " + i + " descent: " + descent);
}
for (int i = 0; i < layout.getLineCount(); i++) {
int ascent = layout.getLineAscent(i);
Log.i("TAG", "line " + i + " ascent: " + ascent);
}
for (int i = 0; i < layout.getLineCount(); i++) {
int top = layout.getLineTop(i);
Log.i("TAG", "line " + i + " top: " + top);
}
for (int i = 0; i < layout.getLineCount(); i++) {
int bottom = layout.getLineBottom(i);
Log.i("TAG", "line " + i + " bottom: " + bottom);
}
Paint.FontMetricsInt fm = editText.getLayout().getPaint().getFontMetricsInt();
Log.i("TAG", "fm top: " + fm.top);
Log.i("TAG", "fm bottom: " + fm.bottom);
Log.i("TAG", "fm ascent: " + fm.ascent);
Log.i("TAG", "fm descent: " + fm.descent);
}
}
中不存在此类交易日期,那么您的查询将无法捕获它。要解决此问题,您可以对日期列表执行外部联接,可以从其他表中提取,也可以使用Oracle SQL函数生成。如果您不想要这么多日期,可以调整purchases
别名封装的表格;目前它只是过去100天:
q2