in reply to Re: Check boxes
in thread Check boxes

Another option would be to add two new tables and go ahead and do a lookup with a join:

  • One table that lists all the options and assigns a key to each one
  • A second table that has two columns-- one is just Car_ID and the other is feature_ID. This is the join table.
  • If car#23 has features #76, 53, and 99 then it would get three rows in the join table, each of which would be the car ID and one of the numbers.

    For the OP this might be overkill, since there aren't likely so many cars that the table will get big, even if it has a lot of columns. It might be slightly slower on the db side, because you have to do a join, but it's probably not significant, again because the tables are probably small. Just another way to do it.

    Replies are listed 'Best First'.
    Re^3: Check boxes
    by mbethke (Hermit) on May 29, 2012 at 06:15 UTC
      The SQL to ask for several features ("which car has ABS and ESR and teledildonics") would get pretty horrible though as you'd have to join in the features table once for each feature. Possible but very very slow and only halfway readable with DBIx::Class and chained ResultSets.