Tag: MYSQL TIPS

MySQL zerofill and lpad – Shape digits in DB

I’m working with an application to have the item code. Item code column is set as an INT(5) but not all the item code values are 5 digits. So I need to round off the item code based on 5-digits. If the item code is 199, it should be display as 00199. How to make …

Continue reading

Permanent link to this article: https://blog.openshell.in/2014/09/mysql-zerofill-and-lpad-shape-digits-in-db/

How to retrieve the last record in each group using mysql

In single SQL query itself we can retrieve the last record in each group. It will help us to perform action better, faster and simpler. In this post I will explain about you how to do it. Here is my table structure for your reference. [sql] desc post_status; +—————-+————-+——+—–+———+—————-+ | Field | Type | Null …

Continue reading

Permanent link to this article: https://blog.openshell.in/2013/10/how-to-retrieve-the-last-record-in-each-group-using-mysql/