<LinearLayout
android:id="@+id/layoutStatus"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layoutAnimation="@anim/list_layout_animation"
android:orientation="horizontal"
android:padding="10.0dip" />
答案 0 :(得分:0)
尝试在此刻评论HAVING部分并查看是否有帮助,一旦获得结果,您可以使用HAVING过滤它
SELECT dbo.RtlStore.Description, COUNT(dbo.InvProduct.U_OwnershipType) AS CONSIGNMENT, COUNT(dbo.InvProduct.U_OwnershipType) AS OUTRIGHT, COUNT(dbo.InvProduct.U_OwnershipType)
AS HOURSEBRAND, COUNT(dbo.InvProduct.U_OwnershipType) AS GOI, COUNT(dbo.InvProduct.U_OwnershipType) AS OTHERS
FROM dbo.RtlStore LEFT OUTER JOIN
dbo.InvProduct LEFT OUTER JOIN
dbo.TrxTransactionSaleItem ON dbo.InvProduct.ProductKey = dbo.TrxTransactionSaleItem.ProductKey LEFT OUTER JOIN
dbo.TrxTransaction ON dbo.TrxTransactionSaleItem.TransactionKey = dbo.TrxTransaction.TransactionKey ON dbo.RtlStore.StoreKey = dbo.TrxTransaction.StoreKey
GROUP BY dbo.RtlStore.Description
--HAVING
-- (COUNT(dbo.InvProduct.U_OwnershipType) = N'CONSIGNMENT')
-- AND (COUNT(dbo.InvProduct.U_OwnershipType) = N'OUTRIGHT')
-- AND (COUNT(dbo.InvProduct.U_OwnershipType) = N'HOUSEBRAND')
-- AND (COUNT(dbo.InvProduct.U_OwnershipType) = N'GOI')
-- AND (COUNT(dbo.InvProduct.U_OwnershipType) = N'OTHERS')
答案 1 :(得分:0)
您是否试图转动数据?如果是这样,试试这个:
SELECT
dbo.RtlStore.Description,
max(case when dbo.InvProduct.U_OwnershipType = N'CONSIGNMENT' then 1 else null end) AS CONSIGNMENT,
max(case when dbo.InvProduct.U_OwnershipType = N'OUTRIGHT' then 1 else null end) AS OUTRIGHT,
max(case when dbo.InvProduct.U_OwnershipType = N'HOUSEBRAND' then 1 else null end) AS HOURSEBRAND,
max(case when dbo.InvProduct.U_OwnershipType = N'GOI' then 1 else null end) AS GOI,
max(case when dbo.InvProduct.U_OwnershipType = N'OTHERS' then 1 else null end) AS OTHERS
FROM
dbo.RtlStore
LEFT OUTER JOIN
dbo.InvProduct
LEFT OUTER JOIN
dbo.TrxTransactionSaleItem ON dbo.InvProduct.ProductKey = dbo.TrxTransactionSaleItem.ProductKey
LEFT OUTER JOIN
dbo.TrxTransaction ON dbo.TrxTransactionSaleItem.TransactionKey = dbo.TrxTransaction.TransactionKey
ON dbo.RtlStore.StoreKey = dbo.TrxTransaction.StoreKey
GROUP BY
dbo.RtlStore.Description