خرید بک لینک

Vote count: 0

I am trying to run a query where I want rows that are In Stock only if they have the highest ID. (As lower ID's of the same set of mac addresses for example, are historic records)

The version of MySQL I am using is 4.0.24

+----------------+-------------+-----+
| mac_address_is | location_is | id  |
+----------------+-------------+-----+
| 00xxF7         | In Stock    | 185 |
| 00xxF7         | Out         | 186 |
| 00xx6A         | In Stock    | 200 |
| 00xx6A         | In Stock    | 201 |

I would like these results: 00xx6A as it's the only one In Stock as the max ID.

The In Stock for 00xxF7 should be disregarded as it's not the latest (highest id for that mac) in the location In Stock.

asked 47 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 12 اسفند 1394 ساعت: 9:30

صفحه بندی