在Mysql中使用Rollup

时间:2017-08-22 15:21:31

标签: mysql

我在mysql中使用汇总时遇到问题。我想要一个看起来像这样的表:

人|计数

约翰| 3

Sam | 2

总计| 5

我写的代码:

SELECT person, count(*), IFNULL(count(*),"Total") AS Count FROM ProductsSold GROUP BY 
person WITH ROLLUP;

但相反,总数保持为空,我的所有计数都在工作台中说BLOB。

1 个答案:

答案 0 :(得分:1)

我猜您要将保留Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: /data/user/0/com.app.sample/files/model/flower/flowerTextures.png (Internal) at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77) at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222) at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:144) at com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)  at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)  at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:96)  at com.badlogic.gdx.graphics.g3d.utils.TextureProvider$FileTextureProvider.load(TextureProvider.java:52)  at com.badlogic.gdx.graphics.g3d.Model.convertMaterial(Model.java:292)  at com.badlogic.gdx.graphics.g3d.Model.loadMaterials(Model.java:268)  at com.badlogic.gdx.graphics.g3d.Model.load(Model.java:107)  at com.badlogic.gdx.graphics.g3d.Model.<init>(Model.java:102)  at com.badlogic.gdx.assets.loaders.ModelLoader.loadModel(ModelLoader.java:54)  at com.badlogic.gdx.assets.loaders.ModelLoader.loadModel(ModelLoader.java:69)  at com.app.sample.sdk.libgdx.ar.Display$2.call(Display.java:71)  at com.app.sample.libgdx.ar.Display$2.call(Display.java:62)  at rx.internal.operators.OnSubscribeFromCallable.call(OnSubscribeFromCallable.java:48)  at rx.internal.operators.OnSubscribeFromCallable.call(OnSubscribeFromCallable.java:33)  at rx.Observable.unsafeSubscribe(Observable.java:8460)  at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)  at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:222)  at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)  at java.util.concurrent.FutureTask.run(FutureTask.java:237)  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818)  Caused by: java.io.FileNotFoundException 结果的人NULL重命名为ROLLUP。这意味着您已在Total列上执行IFNULL构造:

person

使得:

SELECT IFNULL(person,"Total") as person, count(*) AS Count
FROM ProductsSold 
GROUP BY person WITH ROLLUP