mysql - Searching for a range within a comma-separated field -
i have field called 'fits' contains comma separated values this:
120102199105199205,130101199105199205,120101199107199201
where each number first 6 digits fitment code , last 12 digits unique date range.
now, know csv nasty , violates 1nf, alternative normalizing data couple more tables monstrous because of potential number of records
so in effort keep simple i'm trying write query select rows based on providing fitment code , range of dates. far have this:
select data table fits = any( select fits table fits '120102') , fits between "120102199105000000" , "120102999999199205"
the problem is, between...and doesn't work csv data
is there way apply range in query kind of wildcard type of csv data, or sql-side solution normalize?
if want use between values in fits column need normalise data.
this should not problem. how big potential row size? you'd surprised how many records not problem modern database server.
1 million, 10 million, 100 million not problem rdms mysql, mariadb, mssql, postgressql on modern pc.
normalise data , easier.
Comments
Post a Comment