Re: [SQL] A search SQL query

From: <kaiq(at)realtyideas(dot)com>
To: Tom Techoueyres <tom(at)eurobase(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] A search SQL query
Date: 1999-12-02 22:27:05
Message-ID: Pine.LNX.4.10.9912021620570.28359-100000@picasso.realtyideas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)eurobase(dot)net
>
>
> ************
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rini Dutta 1999-12-02 22:52:44 SQLState
Previous Message Tom Techoueyres 1999-12-02 21:38:59 RE: [SQL] A search SQL query