-1

I have this query, invinfinfoid as the condition. I want to display the highest itemid or the latest itemid (because it is auto increment) and not display the previous itemid.

SELECT itemid, block_stock, inveninfoid from inventory_movement where inveninfoid IN (71,72,73) order by itemid desc

the result

itemid   | block_stock | inveninfoid
2313     | 199         | 71
53       | 200         | 73
52       | 200         | 72
51       | 200         | 71

and this result i want, Eliminate itemid 51

itemid   | block_stock | inveninfoid
2313     | 199         | 71
53       | 200         | 73
52       | 200         | 72
ogeb man
  • 9
  • 3

1 Answers1

0

You've done an IN query against inveninfoid(and the itemid 2313 has an inveninfoid of 71).

Instead, you want query IN against itemid:

SELECT itemid, block_stock, inveninfoid from inventory_movement
where itemid IN (71,72,73) order by itemid desc
Obsidian Age
  • 41,205
  • 10
  • 48
  • 71