Received: from ns.eurobase.net (root@ns.eurobase.net [207.153.121.2]) by hub.org (8.9.3/8.9.3) with ESMTP id QAA22946 for ; Thu, 2 Dec 1999 16:45:43 -0500 (EST) (envelope-from tom@eurobase.net) Received: from otto (otto.eurobase.net [207.153.121.21]) by ns.eurobase.net (8.9.3/8.9.3) with SMTP id QAA26838; Thu, 2 Dec 1999 16:45:43 -0500 Reply-To: From: "Tom Techoueyres" To: Cc: Subject: RE: [SQL] A search SQL query Date: Thu, 2 Dec 1999 16:38:59 -0500 Message-ID: <003701bf3d0d$a4becc60$157999cf@eurobase.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Importance: Normal In-Reply-To: Remember that the user will only type 'LM741CNSGS' in the form, and through the query, the results would bring back all 'LM741CNSGS' and all 'LM741CN-SGS' items. What actually i would like the query to do is when searching for 'LM741CNSGS' in the database, it will bring back all 'LM741CNSGS' parts that have a '-' in the part. I hope I explained it better! :) thanks, Tom Techoueyres tom@eurobase.net > -----Original Message----- > From: kaiq@realtyideas.com [mailto:kaiq@realtyideas.com] > Sent: Thursday, December 02, 1999 5:27 PM > To: Tom Techoueyres > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] A search SQL query > > > the bottom line: you may need to use regular expression. However, I'm not > sure it's performance. Also, it is not portable. So, if not really > required, I do not use it. > > a simple minded solution: just use "or": > select * from mytable where note = 'LM741CNSGS' or note = 'LM741CN-SGS'; > > the table name and filed name is not the same as yours. please give us > your "create table" so that we can cut/paste. > > > On Thu, 2 Dec 1999, Tom Techoueyres wrote: > > > Hi, > > > > I am using a cursor search using sql queries to get information from a > > database that has 5 fields. The search is done on one of the > fields which > > are "electronic components parts". > > My users usually type in the all part number they are looking for in the > > form. > > Here is the situation I have, lets say that a user is looking for part > > 'LM741CN-SGS', I have the follwoing queries: > > - select * from inventory where partno like 'LM741CN-SGS' > (exact search) > > - select * from inventory where partno like 'LM741CN-SGS%' > (partial search) > > - select * from inventory where partno like '%LM741CN-SGS%' (extended > > search) > > > > Now I need to create a query that when the user looks for > 'LM741CNSGS', the > > result comes back with all rows with 'LM741CN-SGS' and and all rows with > > 'LM741CNSGS'. > > What would the suggested sql query to provide that type of result? > > > > I would appreciate any feedback. > > > > Thank you, > > > > Tom Techoueyres > > tom@eurobase.net > > > > > > ************ > > >