Hi,

I want to select the part no(part_no), transaction date (curr_date), and in stock qty (cost_layer_qty) from table inv_tran where the product first goes into negative quantity.

Do I use a group by for curr_date, or how do I do this?

Thanks in advance

Hi,

I don't know if I got u but try:

SELECT TOP 1 part_no, curr_date, cost_layer_qty
FROM inv_tran
WHERE (cost_layer_qty < 0)
ORDER BY cost_layer_qty DESC

Hope this works for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.