Levi Smith wrote:
> OK, this seems simple enough and I would be more than happy to google it if
> I could figure out how to phrase what I'm trying to do for a search
> query...
> 
> Here's the situation:
> 
> On a website I have Item ID's that look like 8-6-b110 that consist of three
> parts.  As of the moment I'm duplicating data to make it work and I'm
> trying
> to clean it up so that I only have 3 separate fields in the DB, and not
> another copy of the 3 strung together.  So...
> I currently have:
> " WHERE item_categories.item_category = '$_GET[cat]' AND
> item.long_item_id =
> item_categories.long_item_id");
> Which works fine.
> 
> 
> But I need something like:
> . " WHERE item_categories.item_category = '$_GET[cat]' AND
> 'item.vendor_id .
> "-" . item.refer_id . "-" . item.short_item_id' =
> item_categories.long_item_id");
> 
> Which does NOT work...
> So can fill me in on what the correct phrasing is to ask Mysql to match up
> "several fields combined into one statement with a couple dashes in the
> middle" against a single field?
> 
> Or is that simply not possible and I need to figure out some other way of
> disassembling a variable?  (Which would be another question...)

You might have a look at multi-column indexes. Note that you do not have
to compose a concatenated key to benefit from such an index.

In the current ref. manual, it's section 7.4.4.
  http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html

..jim


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to