Hi Charles,
It is possible by defining Line No for the first query. You have to Order query result by item code. If item code repeat then Next line number should be +1, if a new item code shows in the report then line number should restart with 0.
After doing this, Make another query to retrieve data from first query where Line No =0
All the best for doing this.
Thanks
Unnikrishnan