Hi!
I’m trying to find a way to do this, so, to draw a picture for you, let me say:
I’ve got a column - text type- containing alpha-numeric data (basically a piece of info and sizes)
“COL.050,00-025,00-08,0”
“COL.050,00-040,00-10,0 PUR”
“COL.055,00-040,00-12,0 PUR”
“COL.050,80-038,10-09,5”
“COL.070,00-060,00-10,00 XXX”
“RASC.035,00-045,00-07,0/10,0”
from wich I like to select records containing a number from a int range-number
kind of…
“select * from db where alphanumeric ~* numrange(40.0, 50.0)”
returning
“COL.050,00-025,00-08,0”
“COL.050,00-040,00-10,0 PUR”
“COL.055,00-040,00-12,0 PUR”
“RASC.035,00-045,00-07,0/10,0”
“select * from db where alphanumeric ~* numrange(30.0, 39.0)”
returning
“COL.050,80-038,10-09,5”
“RASC.035,00-045,00-07,0/10,0”
“select * from db where alphanumeric ~* numrange(60.0, 65.0)”
returning
“COL.070,00-060,00-10,00 XXX”
My idea is to do this on PostgreSQL as far as my target device is a mobile (so I think it will do calculations on my server faster than on an external device and table contains about 45000 records)
After a while search on internet I guess the calculations should involve numrange or generate_series, but I don’t arrive to use returned values on this string column.
By the way, I’m newer on PgSQL, so my knowledge is very basic.
Thank you
Image may be NSFW.
Clik here to view.
2 posts - 2 participants