Hello there
I have a db table with two char fields :
log_date char(10)
log_time char(8)
I added a new field log_timestamp of type timestamptz
How do I take the data from log_date and log_time and put it into
log_timestamp ?
update log set log_timestamp = cast (log_date as timestamp) || cast
(
On Thu, 2002-09-12 at 10:22, [EMAIL PROTECTED] wrote:
> Hello there
>
> I have a db table with two char fields :
>
> log_date char(10)
> log_time char(8)
>
> I added a new field log_timestamp of type timestamptz
>
> How do I take the data from log_date and log_time and put it into
> log_timest
Hello there
Unfortunately, I can't change the fieldtype that easy because other
applications use the date as char(10) field as well.
I need to sort the query by the log_date desc (log_date is char(10)). I
tried the following without success :
select id, log_date from userlog order by cast (log
--- Ricardo Javier Aranibar León
<[EMAIL PROTECTED]> wrote:
> Hi List,
>
> I need that somebody help me.
> First, I use PostgreSQL 7.0.3 for linux.
> I need reset my sequence but that it begin in 1
> again when a use nextval.
> And I have been search in
> http://archives.postgresql.org/ about re
Ludwig Lim wrote:
> --- Ricardo Javier Aranibar León
> <[EMAIL PROTECTED]> wrote:
> > Hi List,
> >
> > I need that somebody help me.
> > First, I use PostgreSQL 7.0.3 for linux.
> > I need reset my sequence but that it begin in 1
> > again when a use nextval.
> > And I have been search in
> > htt
Jerome Chochon wrote:
> Thanks for your answer but i have another question.
> Which one is the faster ?
>
> If i write this trigger...
> CREATE TRIGGER trigger_name
> BEFORE DELETE
> ON table_name
> FOR EACH ROW EXECUTE PROCEDURE function();
>
> and this rule:
> CREATE RULE name_rule AS
> ON DE
Hi all,
Suppose that I have a table like this:
att_1 |att_2 |att_3 | att_4
1 | a |y |y1
2 | b |y |y2
3 | a |xx |y3
4 | c |zz |y4
5
"Gaetano Mendola" <[EMAIL PROTECTED]> wrote in message
alq3mr$2s7o$[EMAIL PROTECTED]">news:alq3mr$2s7o$[EMAIL PROTECTED]...
> Hi all,
>
> Suppose that I have a table like this:
>
>
> att_1 |att_2 |att_3 | att_4
>
> 1 | a |y |
On Thu, 12 Sep 2002 [EMAIL PROTECTED] wrote:
>
> Hello there
>
> Unfortunately, I can't change the fieldtype that easy because other
> applications use the date as char(10) field as well.
>
> I need to sort the query by the log_date desc (log_date is char(10)). I
> tried the following without suc
--- [EMAIL PROTECTED] wrote:
> I need to sort the query by the log_date desc
> (log_date is char(10)). I
> tried the following without success :
>
> select id, log_date from userlog order by cast
> (log_date as date) desc
>
> select id, log_date from userlog order by
> date(log_date) desc
>
>
On Thu, 12 Sep 2002, Gaetano Mendola wrote:
> Hi all,
>
> Suppose that I have a table like this:
>
>
> att_1 |att_2 |att_3 | att_4
>
> 1 | a |y |y1
> 2 | b |y |y2
> 3 | a |x
--- Gaetano Mendola <[EMAIL PROTECTED]> wrote:
>
> "Gaetano Mendola" <[EMAIL PROTECTED]> wrote in
> message
> alq3mr$2s7o$[EMAIL PROTECTED]">news:alq3mr$2s7o$[EMAIL PROTECTED]...
> > Hi all,
> >
> > Suppose that I have a table like this:
> >
> >
> > att_1 |att_2 |att_3 | att_4
> >
"Stephan Szabo" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> select distinct on (att_2) * from test
> order by att_2, att_1 desc;
Yes that's right it's help me,
but here the optimizer have some problems:
CREATE VIEW last_user_logs AS
SELECT DISTINCT ON (i
"Gaetano Mendola" <[EMAIL PROTECTED]> writes:
> Yes that's right it's help me,
> but here the optimizer have some problems:
What's the datatype of id_user, and why are you quoting the compared
constant in some cases but not others? I don't think the difference
has anything to do with the view he
On Thu, 12 Sep 2002, Tom Lane wrote:
> "Gaetano Mendola" <[EMAIL PROTECTED]> writes:
> > Yes that's right it's help me,
> > but here the optimizer have some problems:
>
> What's the datatype of id_user, and why are you quoting the compared
> constant in some cases but not others? I don't think
"Tom Lane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> "Gaetano Mendola" <[EMAIL PROTECTED]> writes:
> > Yes that's right it's help me,
> > but here the optimizer have some problems:
>
> What's the datatype of id_user, and why are you quoting the compared
>
On Thu, 12 Sep 2002, Gaetano Mendola wrote:
>
> "Tom Lane" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > "Gaetano Mendola" <[EMAIL PROTECTED]> writes:
> > > Yes that's right it's help me,
> > > but here the optimizer have some problems:
> >
> > What's the
Hi Folks -
I'm working on a global weather database for a client and have hit an issue
which I'm sure has been solved before. Unfortunately, the site search doesn't
pull up anything.
Essentially, I've got two tables, one with city/county/lat/long and another
with lat/long/weather data.
None of
Look at contrib/earthdistance, I **think** it does what you need.
LER
On Thu, 2002-09-12 at 12:44, Tim Perdue wrote:
> Hi Folks -
>
> I'm working on a global weather database for a client and have hit an issue
> which I'm sure has been solved before. Unfortunately, the site search doesn't
> pul
Stephan Szabo <[EMAIL PROTECTED]> writes:
> On Thu, 12 Sep 2002, Tom Lane wrote:
>> What's the datatype of id_user, and why are you quoting the compared
>> constant in some cases but not others? I don't think the difference
>> has anything to do with the view here ...
> At least in current sourc
Greetings-
I have a table of participants to be contacted for a study. Some are in
the "exposure" group, others in the "control" group. This is designated by
a column, typenr, that contains 1 for exposure, 2 for control.
The complication is this: I need to select 200 total. The 200 number
should
Andrew Perrin <[EMAIL PROTECTED]> writes:
> SELECT ... FROM participants
> WHERE typenr=1 AND
> UNION
> SELECT ... FROM participants
> WHERE typenr=2 LIMIT 172
> ORDER BY zip;
I think you need
SELECT * FROM
(
SELECT ... FROM participants
WHERE typenr=1 AND
UNION
(SELECT ... FROM participants
W
> "Andrew" == Andrew Perrin <[EMAIL PROTECTED]> writes:
Andrew> What I've done is to write a script that counts the number
Andrew> of eligible exposure candidates:
Andrew> SELECT count(*) FROM participants WHERE
Andrew> AND typenr=1
Andrew> Then subtract that number (c
On Thu, Sep 12, 2002 at 12:49:21 -0500,
Larry Rosenman <[EMAIL PROTECTED]> wrote:
> Look at contrib/earthdistance, I **think** it does what you need.
There isn't an index for the distance operator. You can use boxes to
limit the candidates if there is a small bound on how far apart points
can b
Thanks! That did it.
The inner parens are necessary - without them the ORDER BY seems to be
parsed as part of the second subquery and is therefore a syntax error.
Best,
Andy
--
Andrew J Perrin - http://www.unc.edu/~aperrin
Assi
On 12 Sep 2002, Roland Roberts wrote:
> > "Andrew" == Andrew Perrin <[EMAIL PROTECTED]> writes:
> ...
> Can you do this via a subselect:
>
> SELECT * FROM
> ( SELECT ... FROM participants
> WHERE typenr=1 AND
> UNION
> SELECT ... FROM participants
> WHERE typen
On Thu, Sep 12, 2002 at 12:49:21PM -0500, Larry Rosenman wrote:
> Look at contrib/earthdistance, I **think** it does what you need.
Thanks, yeah this starts to get me into the realm of what I need. It still
has to run every possible permutation to figure out which one is closest for
each postalco
On Thu, 12 Sep 2002, Andrew Perrin wrote:
> Greetings-
>
> I have a table of participants to be contacted for a study. Some are in
> the "exposure" group, others in the "control" group. This is designated by
> a column, typenr, that contains 1 for exposure, 2 for control.
>
> The complication is
On Thu, 12 Sep 2002, Stephan Szabo wrote:
> On Thu, 12 Sep 2002, Andrew Perrin wrote:
>
> > Greetings-
> >
> > I have a table of participants to be contacted for a study. Some are in
> > the "exposure" group, others in the "control" group. This is designated by
> > a column, typenr, that contain
Andrew Perrin <[EMAIL PROTECTED]> writes:
> Interesting - this would count on the UNION including all cases in the
> first query before those in the second query. Are UNIONed records
> presented in any predictable order?
If you can use UNION ALL then this would be pretty safe to rely on.
If you m
Andrew,
Another approach, one that does not require you to know before constructing
the query how many eligible subjects there are, is not to use a union at all:
SELECT * FROM (
SELECT ... , zip
FROM participants
WHERE (typenr = 1 and ) DESC
LIMIT 200 ) p1
ORDER BY zip;
The inner query gives y
Tim Perdue wrote:
> Hi Folks -
>
> I'm working on a global weather database for a client and have hit an issue
> which I'm sure has been solved before. Unfortunately, the site search doesn't
> pull up anything.
>
> Essentially, I've got two tables, one with city/county/lat/long and another
Hello,
I'd like to select from one table ( contains duplicates ) into a new table.
However the new table is exactly the same as the original ( duplicates
included )
I think I have a problem with my DISTINCT clause - sql below.
It seems the DISTINCT is applied to the whole row not just the 'phon
> SELECT
> DISTINCT phone,
> company_name,
> address,
> state,
> idc_desc_1,
> street_number,
> street_name,
> street_xtra,
> suburb,
> postcode,
> area_code,
> ac_phone,
> fax_area_code,
> fax_phone,
> fax_ac_phone,
> latitude,
>
Christopher,
Thank you.
I though if I'm lucky Chris will be online and will see that one.
Kind regards
Rudi.
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere"
Hi,
Just quickly, DISTINCT ON - Is that Postgresql only ?
Thanks
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
Don't know. I've seen it elsewhere so it might even be "standard".
Chris
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Rudi Starcevic
> Sent: Friday, 13 September 2002 10:50 AM
> To: [EMAIL PROTECTED]
> Subject: [SQL] DISTINCT ON
>
>
> Hi,
>
37 matches
Mail list logo