Generate defined/User defined format Serial No from Database .There may be some condition where
I found this type of query which will help you to find the user format no from database.No. like
001 to 999 .
The Query for MySQL:
select case when (intfield_id<=9 ) then concat('00',cast(intfield_id as CHAR))
when (intfield_id<=99 and intfield_id>9) then concat('0',cast(intfield_id as char)) when
(intfield_id<=999 and intfield_id>9 and intfield_id>99) then concat('0',cast(intfield_id as char))
end columnname from test
I found this type of query which will help you to find the user format no from database.No. like
001 to 999 .
The Query for MySQL:
select case when (intfield_id<=9 ) then concat('00',cast(intfield_id as CHAR))
when (intfield_id<=99 and intfield_id>9) then concat('0',cast(intfield_id as char)) when
(intfield_id<=999 and intfield_id>9 and intfield_id>99) then concat('0',cast(intfield_id as char))
end columnname from test
No comments:
Post a Comment