Re: [GENERAL] row numbering

2005-03-11 Thread Karsten Hilbert
I don't know that much about medicine, so this might be a funny question, but do you really need to know that shots 4 and 5 are missing, I want to be able to display shot 4: ... and shot 5: ... in the application but pull the data from the database, not calculate it in the

Re: [GENERAL] row numbering

2005-03-11 Thread Karsten Hilbert
You can look up our complete schema in our Wiki: http://salaam.homeunix.com/twiki/bin/view/Gnumed/WebHome Go to Deverloper Guide - Database Structure. http://salaam.homeunix.com/twiki/bin/view/Gnumed/DatabaseSchema is more convenient for you guys. Karsten -- GPG key ID E4071346 @

Re: [GENERAL] row numbering

2005-03-11 Thread Bruno Wolff III
On Thu, Mar 10, 2005 at 13:22:05 +0100, Karsten Hilbert [EMAIL PROTECTED] wrote: Also notice that we do have views that display the missing shots per schedule per patient. I just have not found a way to join the two views (that is, given and missing) because that would AFAICT require the

Re: [GENERAL] row numbering

2005-03-09 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-03-01 17:41:46 +0100: There are 5 vaccinations in a given vaccination schedule. Patient had 3 shots. I want the view to show me that shot 4 and 5 are missing without having to enter the cardinality of the vaccination in the original data. I

Re: [GENERAL] row numbering

2005-03-01 Thread Karsten Hilbert
There are 5 vaccinations in a given vaccination schedule. Patient had 3 shots. I want the view to show me that shot 4 and 5 are missing without having to enter the cardinality of the vaccination in the original data. For this kind of task you usually want to use a left (or

Re: [GENERAL] row numbering

2005-03-01 Thread Karsten Hilbert
There are 5 vaccinations in a given vaccination schedule. Patient had 3 shots. I want the view to show me that shot 4 and 5 are missing without having to enter the cardinality of the vaccination in the original data. That sounds like you are trying to abuse the data model, so I'm

Re: [GENERAL] row numbering

2005-03-01 Thread josue
I figured it out, maybe is not the most elegant way but it work for my case where only small sets are retrieved create table foo2 (pk int, valor numeric(12,2), porce numeric(5,2)); insert into foo2 values (1,7893.45,0.4); insert into foo2 values (5,7893.45,0.3); insert into foo2 values

Re: [GENERAL] row numbering

2005-02-28 Thread Peter Eisentraut
NTPT wrote: Having some sort of line numbering in result query would be nice... The query result has line numbering. How else are you accessing the individual rows? Is the issue really that you want psql to number the lines on display? That could be implemented. -- Peter Eisentraut

Re: [GENERAL] row numbering

2005-02-28 Thread NTPT
Eisentraut [EMAIL PROTECTED] Cc: josue [EMAIL PROTECTED]; pgsql-general@postgresql.org Sent: Saturday, February 26, 2005 1:27 AM Subject: Re: [GENERAL] row numbering If you insert the results of your query into a table with a serial column, the serial column will do what you want.. On Sat, 2005

Re: [GENERAL] row numbering

2005-02-28 Thread Karsten Hilbert
is there a way return a column with the row number automatically generated according the way the rows were processed by the query. No, but you can easily keep a counter in the client. How, then, do I do it if I need the row number in a view ? Keep the counter in the client as

Re: [GENERAL] row numbering

2005-02-28 Thread Jay Guerette
OT: You have other database issues: http://www.gnumed.org/ snip error insert into WebLog values(586,31,2005-02-28,ip addr removed) Duplicate entry '2005-02-28' for key 2 /snip On Sun, 27 Feb 2005 18:08:02 +0100, Karsten Hilbert [EMAIL PROTECTED] wrote: is there a way return a column with the

Re: [GENERAL] row numbering

2005-02-28 Thread Karsten Hilbert
OT: You have other database issues: http://www.gnumed.org/ snip error insert into WebLog values(586,31,2005-02-28,ip addr removed) Duplicate entry '2005-02-28' for key 2 /snip Yes I do and no I don't. That database underlies a Wiki written by one of our contributors. Nothing directly

Re: [GENERAL] row numbering

2005-02-28 Thread Peter Eisentraut
Karsten Hilbert wrote: There are 5 vaccinations in a given vaccination schedule. Patient had 3 shots. I want the view to show me that shot 4 and 5 are missing without having to enter the cardinality of the vaccination in the original data. That sounds like you are trying to abuse the data

Re: [GENERAL] row numbering

2005-02-28 Thread Bruno Wolff III
On Mon, Feb 28, 2005 at 17:46:43 +0100, Karsten Hilbert [EMAIL PROTECTED] wrote: There are 5 vaccinations in a given vaccination schedule. Patient had 3 shots. I want the view to show me that shot 4 and 5 are missing without having to enter the cardinality of the vaccination in the

Re: [GENERAL] row numbering

2005-02-27 Thread Karsten Hilbert
is there a way return a column with the row number automatically generated according the way the rows were processed by the query. No, but you can easily keep a counter in the client. How, then, do I do it if I need the row number in a view ? Karsten -- GPG key ID E4071346 @

Re: [GENERAL] row numbering

2005-02-26 Thread Jeff Davis
Here's an example using plperl and global variables. The variables are local to a session so you don't have to worry about the counters interfering. If you need two counters in a session, just execute reset_counter(). CREATE OR REPLACE FUNCTION reset_counter() RETURNS INT AS $$ $_SHARED{counter}

Re: [GENERAL] row numbering

2005-02-26 Thread josue
Jeff Davis wrote: Here's an example using plperl and global variables. The variables are local to a session so you don't have to worry about the counters interfering. If you need two counters in a session, just execute reset_counter(). CREATE OR REPLACE FUNCTION reset_counter() RETURNS INT AS $$

[GENERAL] row numbering

2005-02-25 Thread josue
Hello list, is there a way return a column with the row number automatically generated according the way the rows were processed by the query. For instance: select a,b from foo; a b 20 yes 40 no 15 yes to something like: select counter(),a,b from foo; counter a b 1 20 yes 2 40 no 3

Re: [GENERAL] row numbering

2005-02-25 Thread Peter Eisentraut
josue wrote: is there a way return a column with the row number automatically generated according the way the rows were processed by the query. No, but you can easily keep a counter in the client. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of

Re: [GENERAL] row numbering

2005-02-25 Thread Mike Harding
If you insert the results of your query into a table with a serial column, the serial column will do what you want.. On Sat, 2005-02-26 at 01:10 +0100, Peter Eisentraut wrote: josue wrote: is there a way return a column with the row number automatically generated according the way the rows

Re: [GENERAL] row numbering

2005-02-25 Thread Greg Stark
josue [EMAIL PROTECTED] writes: to something like: select counter(),a,b from foo; The OLAP SQL Standard way to spell this is ROW_NUMBER() OVER (). Postgres doesn't have any support for any of the OLAP features however. It would be really nice because they're nigh impossible to emulate with

Re: [GENERAL] row numbering

2000-05-10 Thread Marcin Inkielman
Hi! thanks for your respose! sorry if i was not very clear with my question... On Wed, 10 May 2000, Peter Eisentraut wrote: Marcin Inkielman writes: how may i easyly obtain row numbers in a query: In the SQL data model, rows don't have numbers, because rows aren't ordered -- a query