[snip]
  Thanks for your reply but I think you are missing my point or I am 
missing yours either way the query does not work when I substitute the 
S for a 0 in the part number as I described previously in detail.  You 
focus on 10902 which does work whether I put single quotes around same 
or not.  The problem is when I use another legitimate part number that 
has a letter in IT,i.e. 109S2, IT does not work whether I put single 
quotes around IT or not! I have tried the 'AND' 'OR' qualifiers but it 
makes no difference!  Please reread my post carefully!!
> [snip]
> IF I use the following statement:
> SELECT  *  FROM  `items`  WHERE  `item` = 10902 HAVING  `venturi_type`
> = 'universal' OR `venturi_type` = 'special';
> I get a complete and full data dump.
>
> IF I change the statement by inserting a 'letter' in this case 'S'
> instead of a 'number' in this case '0' in the 'item', i.e. from 10902
> to 109S2 I get the following error:
> #1054 - Unknown column '109S2' in 'where clause
>
> IF I change the statement by putting single quotes around '109S2' then
> I get an SQL execution completed result from phpMAdmin, but NO data
> dump!
>
> The column 'venturi_type' is the same NO MATTER what part number
'item'
> is and should display, yet it does not.
>
> Why should it make a difference wether I have a letter or a numeral in
> a part number?
> [/snip]
>
> Because the part number may be a string, not a number. Oh sure, it 
> looks
> like a number, but it is really a string. Also, the venturi_type
should
> be a conditional other than a HAVING....try this...
>
> SELECT  *
> FROM  `items`
> WHERE  `item` = '10902' <--(note single quotes around string)
> AND (`venturi_type` = 'universal' OR `venturi_type` = 'special');
>
[/snip]
 I did read and then re-read carefully your post....and the single
quotes are required when the 'S' is there because MySQL thinks that you
have specified a column name....not data. That is why you get a
successful completion of the query when the quotes are there. Since you
cannot specify a column name as a number, when you use the number minus
the 'S' you are essentially asking if the `item` is TRUE (which it is),
so therefore you get all of the data back. Make sense?

Do you have an item 10902 with a universal or special venturi? Do you
have an item 109S2 with a universal or special venturi?

You can also try

SELECT  *
FROM  `items`
WHERE  `item` = '10902'
AND `venturi_type` IN('universal','special');

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to