当我查询:
select * from EventLog as q
where EventTypeId = 3 and q.SomeUserId is not null
order by q.UserId, q.TimeStamp
示例结果是:
ID USERID SomeUserId EventTypeId
36723 1 2333 3 13001009809 NULL 115 2015-01-23 14:56:42.860
36735 1 2334 3 13001009809 NULL 12 2015-01-23 15:48:14.363
36747 1 2335 3 13001009809 NULL 33 2015-01-23 21:22:48.007
36769 1 2338 3 13001009809 NULL 22 2015-01-24 11:55:29.100
36853 1 2347 3 13001009999 NULL 61 2015-07-06 17:24:33.817
36863 1 2351 3 13001034120 NULL 25 2015-12-23 11:42:48.463
36873 1 2352 3 13001034120 NULL 25 2015-12-23 11:46:25.030
36883 1 2353 3 13001034120 NULL 10 2015-12-23 11:49:09.553
964 10 826 3 01005000095 NULL NULL 2013-01-30 15:52:17.653
973 10 829 3 01009005715 NULL NULL 2013-01-30 16:20:46.293
637 12 752 3 35001091797 NULL NULL 2013-01-15 16:50:54.567
738 12 767 3 35001091159 NULL NULL 2013-01-18 10:53:04.143
1316 12 870 3 35001119598 NULL NULL 2013-02-07 11:36:28.503
1377 12 888 3 59002002288 NULL NULL 2013-02-07 13:24:57.777
1389 12 892 3 35001104167 NULL NULL 2013-02-07 14:01:40.920
1408 12 897 3 20001009805 NULL NULL 2013-02-07 15:05:08.577
最后一个是时间戳(另一个并不重要)
如何选择结果:
例如每月注册的SomeUserId是:
1月20日// 0 + 20 = 20
2月50 // 20 + 40 = 70
3月35日// 70 + 35 = 105.现在它是100+。所以在那个查询之后必须 从头开始归还所有东西
4月10日// 0 + 10 = 10等
和每个SomeUserId(这里是1,10,12 ......)
它基于100个注册用户(不会有3个月或12个月的事情)。
答案 0 :(得分:1)
please check your path from mHighQualityImageUri because output path is not found, below code is modify please check it, it work and remember camera result is give in Main Activity class because You used Fragment so declare on activity Result in Main Activity (Fragment Activity) class.
//on Fragment Class
private void takePhoto() {
/* mHighQualityImageUri = Util.generateTimeStampPhotoFileUri(getActivity());
Log.d(UploadPicturesFragment.class.getSimpleName(),
"URI: " + mHighQualityImageUri.toString());*/
imageUri =Uri.fromFile(new File("/sdcard/"));
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
context.startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
}
//on Main Activity Class
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
/* Log.d(UploadPicturesFragment.class.getSimpleName(),
"IMAGE URI NOT NULL: " + (mHighQualityImageUri == null));*/
try {
/*if(imageUri==null){
Log.i("Bitmap", "Image URI Null");
}else {
Log.i("Bitmap","Image URI is not Null");
}*/
Uri imageUri = Uri.fromFile(new File("/sdcard/"));
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(),imageUri);
// mHighQualityImageUri);
if(bitmap !=null)
{
Log.i("Bitmap", "Bitmap not Null");
}else {
Log.i("Bitmap","Bitmap is Null");
}
// DroomUtil.beginCrop(mHighQualityImageUri, getActivity(), this, true, bitmap.getWidth(),
// bitmap.getHeight());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
super.onActivityResult(requestCode, resultCode, data);
}
答案 1 :(得分:0)
您可以使用CASE表达式。
Data Type