Hi Try this..
SELECT Col1 , Col2
FROM yourtable
WHERE to_number(to_char(col1, 'SS'),'99') / 10 ) in
(10,20,30,40,50,00);
HTH
Denis
- Original Message -
From: Vincent Ladlad [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 21, 2004 8:23 AM
Subject: [SQL]
Hello,
I am trying to select distinct dates and order them in the reverse
chronological order. Although the column type is TIMESTAMP, in this
case I want only , MM, and DD back.
I am using the following query, but it's not returning dates back in
the reverse chronological order:
SELECT
On Tue, Apr 20, 2004 at 09:14:48PM +0200, H.J. Sanders wrote:
- BEGIN WORK
- INSERT ROW
- IF FAILED THEN UPDATE ROW
- COMMIT WORK
You can do it the other way. Begin, update; if 0 rows are updated
then insert.
A
--
Andrew Sullivan | [EMAIL PROTECTED]
Hello,
I am trying to select distinct dates and order them in the reverse
chronological order. Although the column type is TIMESTAMP, in this
case I want only , MM, and DD back.
I am using the following query, but it's not returning dates back in
the reverse chronological order:
Thank you and Denis ([EMAIL PROTECTED]) - that was it. I needed
explicit DESC for each ORDER BY criterium.
Otis
--- Stijn Vanroye [EMAIL PROTECTED] wrote:
Hello,
I am trying to select distinct dates and order them in the reverse
chronological order. Although the column type is
David,
I tend to use \ to escape things like ' - I find it makes it somewhat easier
to debug.
What about:
sql_string :=\' INSERT INTO temp_table ( view_name, row_count ) SELECT \'
|| r_rec.viewname ||
\', count(*) FROM \'
This is a not-quite complete implementation of the SY/MS sql datediff. The
months_between function can be extrapolated from it as well. I looked for
it on forums, etc. and all I found were people complaining about the lack of
an example. Please post fixes/changes or a link to a better one... if
Hi all,
first of all, let me explain what I'm trying to do.
I have a table with a fairly complicated trigger. In this trigger I
have a specific set of codelines that can be executed in more than 50
places that works on the new.* fields in order to fix/clean them.
In order to improve
Is there some reason you can't do this:
SELECT DISTINCT
date_part('year', uu.add_date), date_part('month', uu.add_date),
date_part('day', uu.add_date)
FROM uus INNER JOIN ui ON uus.user_id=ui.id INNER JOIN uu ON
ui.id=uu.user_id
WHERE uus.x_id=1
ORDER BY
uu.add_date DESC;
This might
Sorry. I realize I slipped an error in my code:
the code is:
---
CREATE TABLE public.imp_test
(
id int8,
value text
) WITHOUT OIDS;
CREATE OR REPLACE FUNCTION public.imp_test_to_out_test(imp_test)
RETURNS imp_test AS
'begin
return $1;
end;'
LANGUAGE 'plpgsql'
OK, it's been a while since I've had to do anything remotely complex in
SQL, so this may just be a pure brain block on my part.
I have 2 tables, auction and image, defined like this:
Table public.auction
Column | Type |
I read a lot of document and did some search and looked at the source
code of postgres but did not find a simple
solution to my question.
How to set up the programming environment for C.
IN chapter 33 Extending SQL
33.7.5 Writing Code
when run pg_config --includedir-server
I got
Here I have a very simple case
table1
table1_removed
anotherTable
create or replace RULE rec_remove as ON DELETE TO table1
do insert into table1_remove
select old.*, a.acc from old g join anotherTable a on g.acc=a.other_acc;
===
the parser complained ERROR: relation *OLD* does not exist
Bruno Wolff III wrote:
On Wed, Apr 21, 2004 at 14:29:34 -0400,
Heflin [EMAIL PROTECTED] wrote:
So a basic JOIN gets this:
SELECT auction.auction_id, image.image_id, image.image_descr
FROM auction JOIN image ON auction.auction_id = image.auction_id
WHERE auction.auction_owner = 'Mabel';
Now
Two choices that work:
Either add another JOIN in which retrieves the MAX(image_id) for each
auction:
SELECT auction.auction_id, image.image_id, image.image_descr
FROM auction
JOIN image USING(auction_id)
JOIN ( SELECT auction_id, MAX(image_id) AS image_id
FROM image
On Wed, Apr 21, 2004 at 16:28:10 -0400,
Heflin [EMAIL PROTECTED] wrote:
The postgres specific way of doing this is:
SELECT DISTINCT ON (auction.auction_id)
auction.auction_id, image.image_id, image.image_descr
FROM auction JOIN image ON auction.auction_id = image.auction_id
WHERE
Kemin Zhou wrote:
IN chapter 33 Extending SQL
33.7.5 Writing Code
when run pg_config --includedir-server
I got /usr/local/pgsql/include/server but my machine does have this
directory
make install-all-headers
It's explained in the installation instructions.
---(end
17 matches
Mail list logo