Home > Archive > MySQL ODBC Connector > February 2006 > Fw: Re[2]: using WHERE and OR in a query









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Fw: Re[2]: using WHERE and OR in a query
Rhino

2006-02-28, 8:28 pm

I'm putting this discussion back in the mailing list where it belongs; that
way other people can contribute suggestions and learn from the discussion,
either now or in the future via the archives.

--

Is there any possibility the Update is doing exactly what your SQL is
telling it to do? You're asking for a row to be updated if _any_ of the
following are true:
- the subscribe column is not blank
- the artist column contains 1
- the rank_change column does not contain 1

If at least one of those conditions is true for each row in the table, then
it is entirely reasonable that every row gets updated because every row
qualifies for the update. That's why I suggested you provide sample data,
expected results and actual results: if you had done that, I probably
wouldn't have to ask this followup question.

What language is your code? It looks a bit like Perl to me but I sometimes
confuse Perl and PHP.

Is '!=' a legitimate way to say 'not equal' in this version of MySQL and the
language you are using? I normally use either the NOT keyword or the symbols
'<>' to negate conditions, for example:
- WHERE NOT subscribe = ''
- WHERE subscribe <> ''
Some dialects of SQL and some programming languages support '!=' but not all
of them do. You should check that in the MySQL reference for 3.23 and the
programming language, whatever it is.

Are you sure you are executing the statement against the table you _think_
you are updating? For example, Is it possible that you mean to execute the
statement against a production table but are actually executing it against a
test table that has very different data than the production table?

--
Rhino

----- Original Message -----
From: "Bruce Therrien" <bruce.therrien@wm-mw.org>
To: "Rhino" <rhino1@sympatico.ca>
Sent: Saturday, February 25, 2006 4:37 PM
Subject: Re[2]: using WHERE and OR in a query


> the query is updating all records with no regards to the WHERE clauses.
>
>
> On Sat, 25 Feb 2006 16:36:38 -0500
> "Rhino" <rhino1@sympatico.ca> wrote:
>
>
>
> --
> Bruce Therrien <bruce.therrien@wm-mw.org>
>
> This is the end of the internet.
> Please turn around and go back.
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 24/02/2006
>
>




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 24/02/2006


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com