Re: Comparing text field

From: Nirmalya Lahiri <nirmalyalahiri(at)yahoo(dot)com>
To: Nik <XLPizza(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Comparing text field
Date: 2006-04-16 01:23:29
Message-ID: 20060416012329.69358.qmail@web30312.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You have made a wrong mistake in your SQL quary.....
Your quary should be look like this.....

SELECT id FROM table1 WHERE message like '%VAC153-683-685-131830-
/O.NEW.KLWX.SV.W.0022.060413T1742Z-060413T1830Z/
BULLETIN - EAS ACTIVATION REQUESTED
SEVERE THUNDERSTORM WARNING
NATIONAL WEATHER SERVICE BALTIMORE MD/WASHINGTON DC
142 PM EDT THU APR 13 2006
THE NATIONAL WEATHER SERVICE IN STERLING VIRGINIA HAS ISSUED A
* SEVERE THUNDERSTORM WARNING';

--- Nik <XLPizza(at)gmail(dot)com> wrote:

> I am trying to compare a large string (that has new line characters
> in
> it) to the contents of the text field (which also has new line
> characters in it) and it is not behaving as expected.
>
> For example I have the following record in the database:
> id=83
> message=VAC153-683-685-131830-
> /O.NEW.KLWX.SV.W.0022.060413T1742Z-060413T1830Z/
> BULLETIN - EAS ACTIVATION REQUESTED
> SEVERE THUNDERSTORM WARNING
> NATIONAL WEATHER SERVICE BALTIMORE MD/WASHINGTON DC
> 142 PM EDT THU APR 13 2006
> THE NATIONAL WEATHER SERVICE IN STERLING VIRGINIA HAS ISSUED A
> * SEVERE THUNDERSTORM WARNING
>
> If I do the following query
> SELECT id FROM table1 WHERE message='VAC153-683-685-131830-
> /O.NEW.KLWX.SV.W.0022.060413T1742Z-060413T1830Z/
> BULLETIN - EAS ACTIVATION REQUESTED
> SEVERE THUNDERSTORM WARNING
> NATIONAL WEATHER SERVICE BALTIMORE MD/WASHINGTON DC
> 142 PM EDT THU APR 13 2006
> THE NATIONAL WEATHER SERVICE IN STERLING VIRGINIA HAS ISSUED A
> * SEVERE THUNDERSTORM WARNING'
>
> I get no results back, even though the message is equivalent. How
> should I perform this comparison so that the above query returns
> id=83?
>
> Thanks.
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Benjamin Arai 2006-04-16 01:44:18 Google Summer of Code (Fix aggregate operators & Implement features such as Data Cubes and Skyline)
Previous Message Nirmalya Lahiri 2006-04-16 01:04:59 Re: Update from diferents conditions