Tuesday, April 1, 2014

Formatting output so that data repeated between rows is not shown

And because you asked this in t-sql this is how you can do it in T-SQL but I highly unrecommend it unless you dont have a proper front end to do formatting ie for example like excel export etc



SELECT CASE WHEN Seq = 1 THEN ItemCode ELSE '' END AS ItemCode,
CASE WHEN Seq = 1 THEN ItemDecsription ELSE '' END AS ItemDescription,
CASE WHEN Seq = 1 THEN CAST(OrderQty AS varchar(30)) ELSE '' END AS OrderQty,
BINLabel,
BINQty,
... other columns
FROM
(
SELECT ROW_NUMBER() OVER (PARTITION BY ItemCode,ItemDescription,OrderQty ORDER BY ItemCode) AS Seq,*
FROM table
)t





Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment