Creative Codes
Thursday, 29 March 2012
PIVOT query
SELECT 'item_code' AS item_code_count,
[001], [002]
FROM (SELECT loc_id, item_code, entry_no
FROM exp_tran) AS derivedtbl_1
PIVOT
(
count(item_code)
FOR loc_id IN ([001], [002])
) AS PivotTable
order by entry_no
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment