Обсуждение: deleting multiple rows
A very simple SQL question, LOL.
If I want to delete multiple rows, I can use '||' to do it like this, right?
DELETE FROM TableName
WHERE
column = value1 ||
column = value2 ||
column = value4 ||
column = value5
;
On Thu, 1 May 2003, Dennis Gearon wrote: > A very simple SQL question, LOL. > > If I want to delete multiple rows, I can use '||' to do it like this, right? || is generally concatenate. You'll want to use OR. > DELETE FROM TableName > WHERE > column = value1 || > column = value2 || > column = value4 || > column = value5 > ;
On Thu, 2003-05-01 at 19:03, Dennis Gearon wrote: > A very simple SQL question, LOL. > > If I want to delete multiple rows, I can use '||' to do it like this, right? > > DELETE FROM TableName > WHERE > column = value1 || > column = value2 || > column = value4 || > column = value5 > ; Wrong! || is for string concatenation. Possibly you mean: WHERE column = value1 OR column = value2 OR ... -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "For if ye forgive men their trespasses, your heavenly Father will also forgive you; But if ye forgive not men their trespasses, neither will your Father forgive your trespasses." Matthew 6:14,15
As others have pointed out '||' is concatenation, you are looking for
'OR'.
But possibly a nicer way is '... WHERE column IN (value1, value2,
value4, value5);'
Dmitri
-----Original Message-----
From: Dennis Gearon [mailto:gearond@cvc.net]
Sent: Thursday, May 01, 2003 2:03 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] deleting multiple rows
A very simple SQL question, LOL.
If I want to delete multiple rows, I can use '||' to do it like this,
right?
DELETE FROM TableName
WHERE
column = value1 ||
column = value2 ||
column = value4 ||
column = value5
;
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org