我的SUM()在按帐户ID ID分组时,不会添加女性学生人数
这里是查询
public void CleanBitmap()
{
ImageView imageView = (ImageView)FindViewById(Resource.Id.myImage);
Drawable drawable = imageView.Drawable;
if (drawable is BitmapDrawable)
{
BitmapDrawable bitmapDrawable = (BitmapDrawable)drawable;
if (bitmapDrawable.Bitmap != null)
{
Bitmap bitmap = bitmapDrawable.Bitmap;
if (!bitmap.IsRecycled)
{
imageView.SetImageBitmap(null);
bitmap.Recycle();
bitmap = null;
}
}
}
Java.Lang.JavaSystem.Gc();
}
结果如下 Result of the Query
答案 0 :(得分:0)
您正在按错误的列进行分组。如果您希望注册不同课程的学生人数,则必须按course
分组,而不是temporary_answers
答案 1 :(得分:-1)
查询中几乎没有问题,无需将sex = "Female"
写为条件有tbl_temporary.sex = "Female"
的地方。你需要为此if else
写sum(if (course = "BSCS", 1, 0))
。所以改变查询和检查。并在if if列名称中更改 1
SELECT
firstname,
middlename,
lastname,
SUM(if (course = "BSCS", 1, 0)) as BSCS,
SUM(if (course = "BSIT", 1, 0)) as BSIT,
SUM(if (course = "BSIS", 1, 0)) as BSIS,
sex,
course from tbl_temporary
WHERE tbl_temporary.sex = "Female" GROUP BY temporary_answer