RE: DATA TYPE QUESTIONS?
[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 HAVINGtry 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 postand the single quotes are required when the 'S' is there because MySQL thinks that you have specified a column namenot 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]
RE: DATA TYPE QUESTIONS?
[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 HAVINGtry this... SELECT * FROM `items` WHERE `item` = '10902' --(note single quotes around string) AND (`venturi_type` = 'universal' OR `venturi_type` = 'special'); -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: DATA TYPE QUESTIONS?
Here is the requested data dump from DESC items; id int(10) PRI NULLauto_increment itemvarchar(30) brands text categorytext subcategory text dimension.A varchar(10) dimension.B varchar(10) venturi_typetext dimension.venturi.A varchar(5) dimension.venturi.B varchar(5) materialtext listprice varchar(10) description_htmltext weight varchar(11) filenametext Tommy Barrios WEBZIGHT.COM http://www.webzight.com If you've got a good thing going, don't fix it! On May 9, 2005, at 3:20 PM, sol beach wrote: Please post the output from DESC items; On 5/9/05, Tommy Barrios [EMAIL PROTECTED] wrote: Let me try this again, reworded for further clarity. 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? BTW this is not my server and I have no control over how the MySQL database was initially setup or configured. Tommy Barrios WEBZIGHT.COM http://www.webzight.com If you've got a good thing going, don't fix it! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]