tælle rækker
HejsaDenne sql:
SELECT PartOrders.PartVendorID, ISNULL(Warehouses.WareHouseName, 'OnSite') AS WareHouseName, PartVendors.PartVendorName
FROM PartOrders INNER JOIN
Activities ON PartOrders.ActivityID = Activities.ActivityID LEFT OUTER JOIN
PaymentTypes ON Activities.PaymentTypeID = PaymentTypes.PaymentTypeID LEFT OUTER JOIN
WorkFlows ON Activities.WorkFlowID = WorkFlows.WorkFlowID INNER JOIN
ActivityDetails ON Activities.ActivityDetailID = ActivityDetails.ActivityDetailID INNER JOIN
Queues ON ActivityDetails.QueueID = Queues.QueueID INNER JOIN
PartVendors ON PartOrders.PartVendorID = PartVendors.PartVendorID LEFT OUTER JOIN
Users ON Queues.QueueUserID = Users.UserID LEFT OUTER JOIN
Warehouses ON Users.WareHouseID = Warehouses.WareHouseID
WHERE (PartOrders.PartOrderStatusID = 1) AND (PartOrders.DeliveryWareHouseID = 0)
giver resultatet:
PartVendorid PartVendorName Warehousename
2 Fujitsu-Siemens Computer Hørsholm
2 Fujitsu-Siemens Computer Nørrebro
1 hp computer Århus
Jeg vil gerne have det samlet således, med en ekstra tælle række og sorteret efter partvendorid/partvendorname, således:
PartVendorid PartVendorName Antal
2 Fujitsu-Siemens Computer 2
1 hp computer 1
Er her nogen som kan hjælpe mig?
Hilsen
Henrik