Jordan Michaels wrote:
> 
> I have a database of items and item numbers, something like this:
> 
> ID   Item
> 1-12   Apples
> 12-123 Oranges
> 123-1   Bananas
> 
> Here's the problem that I'm running into: I want to run a query for item 
> numer 112, but I don't know where the dash is in the Item Number (ID). 
> Is there any way that I can query the database for the item number and 
> just have it ignore the dashes that may or may not be in the field name?
> 
> Right now I'm using a PostgreSQL 7.3 database

WHERE CAST(REPLACE(ID, '-', '') AS INTEGER) = <cfqueryparam>

If you need to do this often you should consider a funtional index.

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204435
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to