A book I've found very usefull is 'MySQL and mSQL' by O'Reilly

You could use a query like this, but...

"select distinct item_number from Attributes where attribute like 'football'
and value like 'nfl' "

You will be happier if you rethink your layout and create multiple tables.
Give them unique identifiers (to link them) and your job will be much
easier. I can give you some suggestions if you like.

    ^ ^
    . .
>(   O   )<
     M
~ Seien Sie eins mit dem Rad ~
                 - Pruf-Gerbil -


-----Original Message-----
From: Chris Haupt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 20, 2001 4:42 PM
To: [EMAIL PROTECTED]
Subject: Query to return products given matches on attributes


Hello,

I have a question about the best way to pose this question:

We have a table named Attributes:
+-------------+------------------+------+-----+---------+----------------+
| Field       | Type             | Null | Key | Default | Extra          |
+-------------+------------------+------+-----+---------+----------------+
| item_number | varchar(50)      | YES  |     | NULL    |                |
| attribute   | varchar(20)      | YES  |     | NULL    |                |
| value       | varchar(30)      | YES  |     | NULL    |                |
+-------------+------------------+------+-----+---------+----------------+

Sample values for an item from Attributes
+-------------+--------------+--------------------------------+
| item_number | attribute    | value                          |
+-------------+--------------+--------------------------------+
| OGI-02035   | Price        | LT_75                          |
| OGI-02035   | Sport        | Football                       |
| OGI-02035   | League       | NFL                            |
| OGI-02035   | TypeB        | Jersey                         |
+-------------+--------------+--------------------------------+

An example query I'm trying to figure out is:
Return all item_numbers where sport="football", league="nfl" and
typeb="jersey"

Any help would be appreciated.  Also any pointers to good books that
people have found that help them solve such problems.

Thanks,

Chris
============  O  N  L  I  N  E    S  P  O  R  T  S  =============
Chris Haupt                                [EMAIL PROTECTED]
Online Sports                         http://www.onlinesports.com
Phone: 760-839-9363                             Fax: 760-839-9370
  Directory of Thousands of Sports Items Available Online Today!
====  P  R  O  D  U  C  T  S    &    S  E  R  V  I  C  E  S  ====

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to