我有这样的excel表
RETAIL_SKU STUDIO_NAME REGION MERCHANT SOURCE_TYPE RETOUCH_LEVEL
CCCF9X55FI CCRY1B EU Buy VIP Studio 9
CCCHB1Z8EE PCCL3B NA Buy VIP Studio 9
CCCFECJQ1I LEJ1A EU Buy VIP Studio 9
CCCH296DN0 CCRY1B EU Buy VIP Studio 9
CCCEQR38LQ PCCL3B NA Buy VIP Studio 9
CCCHSC2X0I PCCL3B NA Buy VIP Studio 9
CCCA0IY4OU BV-DE-RETAIL EU Buy VIP Vendor 9
CCCGX64C68 PCCL3B NA Buy VIP Studio 9
CCCG7U7W4O CCRY1B EU Buy VIP Studio 9
看这样的结果
STUDIO_NAME REGION
CCRY1B 3
PCCL3B 4
LEJ1A 1
BV-DE-RETAIL 1
我试图通过Ado-db实现这一点。但到目前为止我还没有找到任何解决方案。
这是我试过的下面的代码
str = "SELECT STUDIO_NAME,COUNT(*) RETAIL_SKU FROM [Sheet7$] WHERE MERCHANT='Buy VIP' AND RETOUCH_LEVEL=9 GROUP BY STUDIO_NAME"
rsEx.Open str, ConEx, adOpenKeyset, adLockOptimistic ' this is where i'm getting error
我收到以下错误
答案 0 :(得分:1)
您的SQL语句应该是这样的
SELECT STUDIO_NAME,COUNT(*) AS REGION FROM [Sheet7$] WHERE MERCHANT='Buy VIP' AND RETOUCH_LEVEL=9 GROUP BY STUDIO_NAME