Thread: Non case sensitive
Is there a way that select's where clause can be used as insensitive to the case? I mean:
"SELECT * FROM table WHERE field LIKE 'f' " will return every row that field begins with a "f" or a "F". Without writing " field LIKE 'f' OR field LIKE 'F' " of course.
Thanks
Express yourself instantly with Windows Live Messenger! Windows Live Messenger!
"SELECT * FROM table WHERE field LIKE 'f' " will return every row that field begins with a "f" or a "F". Without writing " field LIKE 'f' OR field LIKE 'F' " of course.
Thanks
Express yourself instantly with Windows Live Messenger! Windows Live Messenger!
You can use a contrib module "citext" (http://gborg.postgresql.org/project/citext/projdisplay.php) for that purpose.
Thanks,
--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)
Thanks,
--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)
On 8/14/06, roy simkes < roysimkes@hotmail.com> wrote:
Is there a way that select's where clause can be used as insensitive to the case? I mean:
"SELECT * FROM table WHERE field LIKE 'f' " will return every row that field begins with a "f" or a "F". Without writing " field LIKE 'f' OR field LIKE 'F' " of course.
Thanks
Express yourself instantly with Windows Live Messenger! Windows Live Messenger!
On 8/14/06 8:57 AM, "roy simkes" <roysimkes@hotmail.com> wrote: > Is there a way that select's where clause can be used as insensitive to the > case? I mean: > "SELECT * FROM table WHERE field LIKE 'f' " will return every row that field > begins with a "f" or a "F". Without writing " field LIKE 'f' OR field LIKE 'F' > " of course. Use ILIKE instead of LIKE? Sean
roy simkes wrote: > Is there a way that select's where clause can be used as insensitive to the case? I mean: > "SELECT * FROM table WHERE field LIKE 'f' " will return every row that field begins with a "f" or a "F". Without writing " field LIKE 'f' OR field LIKE 'F' " of course. try: "SELECT * FROM table WHERE LOWER(field) LIKE 'f'" or: "SELECT * FROM table WHERE LOWER(field) LIKE LOWER(x)" <-- if using variable "x"
That's it!!! Thanks!
> Date: Mon, 14 Aug 2006 09:12:58 -0400
> Subject: Re: [NOVICE] Non case sensitive
> From: sdavis2@mail.nih.gov
> To: roysimkes@hotmail.com; pgsql-novice@postgresql.org
>
>
>
>
> On 8/14/06 8:57 AM, "roy simkes" <roysimkes@hotmail.com> wrote:
>
> > Is there a way that select's where clause can be used as insensitive to the
> > case? I mean:
> > "SELECT * FROM table WHERE field LIKE 'f' " will return every row that field
> > begins with a "f" or a "F". Without writing " field LIKE 'f' OR field LIKE 'F'
> > " of course.
>
> Use ILIKE instead of LIKE?
>
> Sean
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
With MSN Spaces email straight to your blog. Upload jokes, photos and more. It's free! It's free!
> Date: Mon, 14 Aug 2006 09:12:58 -0400
> Subject: Re: [NOVICE] Non case sensitive
> From: sdavis2@mail.nih.gov
> To: roysimkes@hotmail.com; pgsql-novice@postgresql.org
>
>
>
>
> On 8/14/06 8:57 AM, "roy simkes" <roysimkes@hotmail.com> wrote:
>
> > Is there a way that select's where clause can be used as insensitive to the
> > case? I mean:
> > "SELECT * FROM table WHERE field LIKE 'f' " will return every row that field
> > begins with a "f" or a "F". Without writing " field LIKE 'f' OR field LIKE 'F'
> > " of course.
>
> Use ILIKE instead of LIKE?
>
> Sean
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
With MSN Spaces email straight to your blog. Upload jokes, photos and more. It's free! It's free!