Selecting and grouping similar fields in mysql to populate a dropdown -
I have a selected field that I need to populate from mysql in preparing for execution in search [when Form is deposited]
# 3 # 3 sp # 4 # 4 Las # 4 pp # 4 pi # 4 pvc 2b2b pvc 2b / pi
I select them in select control and group is required so that option View types:
& lt; Option value = "# 3" & gt; # 3 & lt; / Options & gt; & Lt; Option value = "# 4" & gt; # 4 & lt; / Options & gt; & Lt; Option value = "2b" & gt; 2B & lt; / Options & gt; & Lt; Option value = "ALUM" & gt; ALUM & lt; / Options & gt; & Lt; Option value = "QQ" & gt; QQ & lt; / Options & gt; & Lt; Option value = "QQ 2A" & gt; QQ 2A & lt; / Options & gt; & Lt; Option value = "ro pvc" & gt; RO PVC & lt; / Options & gt; & Lt; Option value = "SCRP" & gt; SCRP & lt; / Options & gt; & Lt; Option value = "scraps" & gt; SCRAP & lt; / Option & gt;
Without all the prefixes, all the groups will no longer be the first two letters and all items will not be grouped, i.e. there are such things on:
ALUM QQ QQ 2A RO PVC SCRP scrap
Those items should not be grouped.
What I am currently doing is the direct selection:
Choose from different inventory_data (end), where `FIN '! = 'Order' 'over; Unfortunately, this is an existing database that I can not change and for this there is no group table or relationship to do this To do this Any suggestions on the best way?
Updates - There are more than 10,000 records, about 50+ or so many end types
- Some patterns, though Things can be told from the group like "AB starts with AB, but not AB", to keep things confused, AB can join another finish type i.e. # 2 ABS, so I use things Can not do as: As we think things, sometimes we think '% AB%'
The solution was:
Select different (end) from inventory_data where `again '! = '' And 'finish' no 'REGEXP' ^ # 2 | ^ # 4; ^ BA; Etc. 'order' by `finish ';
Then just add the requirements after adding the query. I can use various REGEX for some more complex circumstances
Comments
Post a Comment