[SQL] slow count(CASE) query

2009-10-29 Thread Grant Masan
Hi all, I have this kind of query that I need to do, yes my query is giving right answers now but it is long and slow. I am now asking you that if you have another solution for my query to make that more smarter ! Hope you can help me with this ! select '000100' as length, sum(ship1) as ship1 ,s

Re: [SQL] left joins

2005-07-06 Thread Grant Morgan
Thank you Richard and Nick, your right. And what Nick showed below is what I wanted. Cheers, Grant On Wed, 06 Jul 2005 19:33:03 +0900, Nick Stone <[EMAIL PROTECTED]> wrote: I've had exactly yhe same problem - try changing the query to. select count(*) from h left join p using

[SQL] left joins

2005-07-06 Thread Grant Morgan
joins , and both using and on , nothing seems make a difference. Questions 1)should a left join return atleast as many rows as the unjoined left table? 2)am I doing something wrong above? 3)If am not doing anything wrong is this postgresql problem and is there a work around? C

Re: [SQL] Foreign character struggles

2002-10-28 Thread Tony Grant
turned the to_ascii stuff off. See www.3continents.com/base_de_donnees.htm and search for "Amnésie" if you want the english search to work you search for "Amnesia"... The client wants the user to check spelling... Before it worked just the way you wanted _but_ I am using a JDBC reque

Re: [SQL] Delete coloumn

2001-08-06 Thread Grant
My response was incorrect! That's what you get for using phppgadmin all day everyday. A transparent feeling that there is alter table drop column support in postgresql :) Sorry. > > Please send to me how to delete coloumn in SQL. > > Thank's > > http://www.ca.postgresql.org/users-lounge/docs/7.1

Re: [SQL] Delete coloumn

2001-08-06 Thread Grant
> Please send to me how to delete coloumn in SQL. > Thank's http://www.ca.postgresql.org/users-lounge/docs/7.1/reference/ Bookmark the above URL. ALTER TABLE is what you are looking for: http://www.ca.postgresql.org/users-lounge/docs/7.1/reference/sql-altertable.html

Re: [SQL] automatic restore of database

2001-07-10 Thread Grant
www.postgresql.org/docs Go to Admin and look up pg_dump. It has some nice examples. A postgresql backup script is available at http://database.sourceforge.net ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTE

Re: [SQL] Sequence behaviour.

2001-06-19 Thread Grant
> > binary_data=# create sequence test; > > CREATE > > binary_data=# select nextval('test'); > > NOTICE: test.nextval: sequence was re-created > > Um, how did you get that NOTICE? I don't see it. This is version 7.0.3. I deleted the sequence first. > Anyway, the answer to your question is tha

[SQL] Sequence behaviour.

2001-06-18 Thread Grant
Why is the following like it is? I would think that nextval would return 2 in both instances, am I missing something here? :) Thanks! binary_data=# create sequence test; CREATE binary_data=# select nextval('test'); NOTICE: test.nextval: sequence was re-created nextval - 1 (1 row)

Re: [SQL] Huh? Data typing bug?

2001-06-04 Thread Grant
You got difference in seconds as the result? Show some examples. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl

Re: [SQL] batch file

2001-05-29 Thread Grant
> I want to execute several SQL statements one after another. > Does anyone know if it is possible to create something like a "batch file" > which contains all SQL commands I want. That or just separate commands by a semi colon: select * from table1; select * from table2; -

Re: [SQL] problem while starting server ??? (fwd)

2001-05-20 Thread Grant
I don't know how this got to me when it was sent to [EMAIL PROTECTED], but anyway here's the answer: psql -U postgres template1 On Sun, 20 May 2001, Subhramanya Shiva wrote: > Hi all > > I installed postgresql successfully. > But when i starting the server it is showing the server status diff

Re: [SQL] use of arrow keys to traverse history

2001-04-25 Thread Grant
I am finding that I can't use the cursor keys at all in psql after I upgraded to v7.1. I have installed v7.1 on redhat 7.1, mandrake 7.2, redhat 6.2 and none of them allow me to use the cursors keys, where as v7.0.3 did. I haven't changed anything on the system except upgrade postgresql to v7.1. A

Re: [SQL] use of arrow keys to traverse history

2001-04-25 Thread Grant
> That's because your version (talking about binaries) are not compiled with > readline support. :-) Which binaries are not compiled with readline support? Why did this change from 7.0.3 -> 7.1? Thanks. ---(end of broadcast)--- TIP 5: Have you

Re: [SQL] Timezone conversion

2001-04-18 Thread Grant
Convert it to timestamp and minus TIMEZONE * 3600... On Wed, 11 Apr 2001, Roberto Mello wrote: > Hi, > > How can I do timezone conversions in PG? I looked on the docs and > couldn't find how. I want to find the current time in another timezone. > > Thanks, > > -Roberto

Re: [SQL] Serials.

2001-03-25 Thread Grant
> Grant writes: > > I have a message board. Where users can send each other messages. I > > doubt I will ever get 2147483647 messages, but I want to make sure I > > never get an error where the message isn't sent. > > Think about loads. If your users are going to

Re: [SQL] Serials.

2001-03-24 Thread Grant
> > (1) Why is a sequence limited to 2147483647, it seems very small? > > Yikes! What are you counting? :-) I have a message board. Where users can send each other messages. I doubt I will ever get 2147483647 messages, but I want to make sure I never get an error where the message isn't sent.

[SQL] Serials.

2001-03-23 Thread Grant
Please see below for my table schema. I have two questions. (1) Why is a sequence limited to 2147483647, it seems very small? (2) If I reset the sequence, then try another insert. It will not insert anything until it cycles through all sequences and finds an unused one. It will give the followin

[SQL] LEFT JOIN

2001-03-21 Thread Grant Furick
I am trying to output news. An article can have an image or not sometimes. Can someone help me get this to work in Postgres? select a.article_id, a.title, a.url, a.synopsis, a.publish_date, c.parent_category_id, c.category_id, c.category_name, i.server_image_name from ((article a JOIN articl

Re: [SQL] Maybe a Bug, maybe bad SQL

2001-03-20 Thread Grant
version 7.0.3 binary_data=# select day, date_part('day', day) AS day from test; day | day +- 02/04/2000 | 2 01/04/2000 | 1 03/04/2000 | 3 (3 rows) binary_data=# Why does everyone reply to the person as well as CC to the list when the person is on the list anyho

[SQL] hierarchical order equivalent

2001-03-18 Thread Grant Furick
categories. I want an easy way to output the tree. Any ideas? Thanks, Grant ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through

Re: [SQL] No Documentation for to_char(INTERVAL, mask)

2001-03-05 Thread Grant
Did you see: http://www.postgresql.org/users-lounge/docs/7.0/user/functions2872.htm On Mon, 5 Mar 2001, Josh Berkus wrote: > I can't find any documentation for what masks to use with the function > TO_CHAR(INTERVAL, mask). Is there a TO_CHAR(INTERVAL)? If so, what > masks are there? If

[SQL] Vacuum.

2001-03-05 Thread Grant
Does vacuuming and analyzing a database affect the users if they are currently inserting/deleting rows from a table on the database? How does it work exactly... Thanks. ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unr

[SQL] How to count elements in an array?

2001-03-05 Thread Grant
How can I obtain a count (number) of elements in a text array? Thanks. test=# \d array Table "array" Attribute | Type |Modifier --+-+ id | integer | not null def

Re: [SQL] Returning Recordsets from Stored-procs

2000-11-06 Thread Grant Finnemore
base or MS-SQL. > > I have seen that you can return a complete record but that's not really the same >thing. > > Marc Rohloff Regards, Grant -- > Poorly planned software requires a genius to write it > and a hero to use it. Grant Finnemore BSc(Eng) (mailto:[EMAIL PROTECT

Re: [SQL] Outer Joins

2000-11-01 Thread Grant Finnemore
Marc, I did not look at your queries, but outer joins are supported in the latest development version of PostgreSQL, and will be supported in the upcoming 7.1 release of the software - beta due soon. Regards, Grant Marc Rohloff wrote: > I've been looking at the open-source databas

Re: [SQL] renaming columns... danger?

2000-10-27 Thread Grant Finnemore
also, and this may actually the source of the problem, > while scanning my full (schema and data) dump, I > noticed that the contents of table pga_layout also had > the old values of columns that I have renamed. > > I'm very frightened right now, because I'm rather > depe

Re: [SQL] Q: performance on some selects (7.0.2)?

2000-10-04 Thread Grant Finnemore
Emils, There is no index on articles.id (should it not be a primary key?) Regards, Grant Emils Klotins wrote: > A typical query runs like this: > > SELECT a.id,a.title,c.fullpath,c.section FROM articles > a,articles_groups x,newscategories c WHERE x.articleid=a.id AND > a.cate

Re: [SQL] trigger or something else?

2000-07-03 Thread Grant Finnemore
done on the view. See the docs for details on how to do this. > > -- > Anatoly K. Lasareff Email: [EMAIL PROTECTED] Grant -- > Poorly planned software requires a genius to write it > and a hero to use it. Grant Finnemore BSc(Eng) (mailto:[EMAIL PROTECTED]) Softwar

Re: [SQL] adding fields containing NULL values

2000-05-29 Thread Grant Finnemore
ras, 0) as total FROM ... Regards Grant -- > Poorly planned software requires a genius to write it > and a hero to use it. Grant Finnemore BSc(Eng) (mailto:[EMAIL PROTECTED]) Software Engineer Universal Computer Services Tel (+27)(11)712-1366PO Box 31266 Braamfontein 2017, Sou

Re: [SQL] Rollback & Nextval fails

2000-05-29 Thread Grant Finnemore
ue that you require. This has the effect of serializing every client update transaction where this scheme is used. Can you afford that? Regards, Grant -- > Poorly planned software requires a genius to write it > and a hero to use it. Grant Finnemore BSc(Eng) (mailto:[EMAIL PROTECTED]) Software En