MySQL Forums
Forum List  »  Newbie

Newbie Needs Help!
Posted by: external_Box
Date: March 28, 2005 02:56PM

I am in need of assistance.

Summary: I have a database with part numbers. Some part numbers contain hyphens. I want to be able to enter a part number without hyphens to be able to search for part numbers with hyphens.

Example: A user enters 4000. I would like for the user to be able to get the results for 4000, 40-00, 40-0-0, etc.

I can't seem to come up with solid enough syntax to process this. Some users may even enter up to 10 digits worth of a part number.

The following appears to work on a database of small size, but I have a huge database. Also, I have some WHERE statements I would like to include. Can WHERE statements be used with HAVING?

SELECT standard_inventory.inv_id, standard_inventory.inv_partnum, REPLACE(standard_inventory.inv_partnum, '-', '') AS temp, standard_inventory.inv_compid, standard_inventory.inv_condition, standard_inventory.inv_price, standard_inventory.inv_quantity, standard_inventory.inv_manuf, standard_inventory.inv_insert_date, standard_inventory.inv_desc, standard_inventory.inv_wts, company.comp_id, company.comp_flag
FROM
standard_inventory, company
HAVING
temp LIKE '$partnum%'

Options: ReplyQuote


Subject
Written By
Posted
Newbie Needs Help!
March 28, 2005 02:56PM
March 28, 2005 03:51PM
March 28, 2005 04:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.