SELECT Case When Rank=1 then
`Company`
Else ''
End as Company,
Case When Rank=1 then
`Date`
Else ''
End as `Date`,
Case When Rank=1 then
`Paper`
Else ''
End as `Paper`,
`Condition`
FROM (SELECT t.*,
CASE
WHEN @Company != t.Company OR @Date != t.`Date` OR @Paper != t.`Paper`
THEN @rownum := 1
ELSE @rownum := @rownum + 1
END AS rank,
@Company := t.Company AS var_category,
@Date := t.`Date` AS var_Date,
@Paper := t.`Paper` AS var_Paper
FROM Table1 t
JOIN (SELECT @rownum := null, @Company := '') r ) x
Resultado
Company Date Paper Condition
Company1 19-12-2007 PaperA Release Second Term
Add Third Term
Append First Term
Demonstração ao vivo