Re: [SQL] safely exchanging primary keys?

2010-06-02 Thread jr
hi Louis-David, tmp := nextval('cabin_type_id_cabin_type_seq'); seems to me you're adding a newly created key value (for which there isn't a record yet). -- regards, jr. (j...@tailorware.org.uk) -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To

Re: [SQL] return %ROWTYPE from function

2010-06-02 Thread jr
hi Anton, works fine if you write: create or replace function get_rec (in p_id test.id%TYPE) returns test as $$ -- regards, jr. (j...@tailorware.org.uk) -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [SQL] Timestamp, epoch and a bit confusion

2008-03-12 Thread Valter Douglas Lisbôa Jr.
Thank you, very much. I pass through extract(epoch from x). On Wednesday 12 March 2008 19:58:07 Aurynn Shaw wrote: > Valter Douglas Lisbôa Jr. wrote: > > Hello all. > > > > I working with postgreSQL for a couple of months, and now I trying to > > convert timestamp co

[SQL] Timestamp, epoch and a bit confusion

2008-03-12 Thread Valter Douglas Lisbôa Jr.
branch? I think the Manual on the main site is not very helpfull in this case!!! ;-( Thanks in advance. -- Valter Douglas Lisbôa Jr. Sócio-Diretor Trenix - IT Solutions "Nossas Idéias, suas Soluções!" www.trenix.com.br [EMAIL PROTECTED] Tel. +55 19 3402.2957 Cel. +55 19 9183.4244 --

Re: [SQL] Support for SQL TOP clause?

2008-01-10 Thread Richard Broersma Jr
me < I2.name WHERE --any where criteria you might have GROUP BY I1.name, ... HAVING COUNT(*) < 3 ORDER BY I1.name; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by dona

Re: [SQL] Get the max(value1, value2, value3) from a table

2008-01-07 Thread Richard Broersma Jr
--- On Mon, 1/7/08, Scott Marlowe <[EMAIL PROTECTED]> wrote: > select max(col1) from table > union all > select max(col2) from table > union all > select max(col3) from table Would the following work also? SELECT MAX( GREATEST( col1, col2, col3 ) ) FROM TABLE; Regards

Re: [SQL] Limit # of recs on inner join?

2007-12-31 Thread Richard Broersma Jr
SELECT DISTINCT ON ( B.book_id, B.title ) B.book_id, B.title, A.Author FROM Books AS B INNER JOIN Authors AS A ON A.book_id = B.book_id; --- On Mon, 12/31/07, Josh <[EMAIL PROTECTED]> wrote: > From: Josh <[EMAIL PROTECTED]> > Subject: [SQL] Limit # of recs on inner join? > To:

Re: [SQL] Advice for generalizing trigger functions

2007-12-27 Thread Richard Broersma Jr
etermine the Primary Key components of the table that will also be needed in the SQL string that will be executed? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] how to use pgsql like mssql

2007-12-26 Thread Richard Broersma Jr
from the SQL prompt? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] how to use pgsql like mssql

2007-12-26 Thread Richard Broersma Jr
guage.html You should probably use PLpgSQL since it is available across OS all platforms and is easy to learn and use. http://www.postgresql.org/docs/8.2/interactive/plpgsql.html There are some nice examples in this documentation. Your PGadmin will also have features to help the cre

Re: [SQL] need help

2007-12-26 Thread Richard Broersma Jr
postgresql references." Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] need help

2007-12-26 Thread Richard Broersma Jr
not, but you can find alot of PostgreSQL people on IRC: http://www.postgresql.org/community/irc Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Advice for generalizing trigger functions

2007-12-26 Thread Richard Broersma Jr
;s state that existed in "times passed". If I didn't need to regularly provide this functionality, I would certainly use an EAV history table. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/read

[SQL] Advice for generalizing trigger functions

2007-12-25 Thread Richard Broersma Jr
ze these myriad of functions into one? Below is a sample of a typical logging trigger function. Regards, Richard Broersma Jr. CREATE OR REPLACE FUNCTION "project"."log_managers_ops"() RETURNS trigger AS $BODY$ BEGIN IF TG_OP IN ( 'UPDATE', 'DELETE&#x

Re: [SQL] Describe Table

2007-12-17 Thread Richard Broersma Jr
construct my own sql queries that provide the same useful information as 'psql \d'. So instead, I cheat: start psql with the '-E' option to echo all sql strings psql sends to the back-end server. Simply copy and tailor each statement to suit your needs. Regards, Richard

Re: [SQL] Insert Rule, Multiple Insert, Update Problem

2007-12-10 Thread Richard Broersma Jr
--- On Mon, 12/10/07, Scott <[EMAIL PROTECTED]> wrote: > I am having trouble with an insert rule that also does an > update. It works > fine for a single insert but multiple inserts in a single > statement don't > behave as I expected. Yup, that is the limitation of rules. They are only useful

[SQL] Bad Schema Design or Useful Trick?

2007-11-21 Thread Richard Broersma Jr
ts( part_nbr, part_type) ON DELETE CASCADE ON UPDATE CASCADE); Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] update on join ?

2007-11-21 Thread Richard Broersma Jr
you are probably after: UPDATE Inventory SET number = 0 FROM Things WHERE Inventory.thing_fk = Things.thing_id AND Things.color = 'red'; IIRC, Joe Celko referrers to this syntax as "T-SQL". Regards, Richard Broersma Jr. ---(end of broadcast)-

Re: [SQL] postgres bogged down beyond tolerance

2007-11-14 Thread Richard Broersma Jr
to : [EMAIL PROTECTED] . This mailing list ( pgsql-sql@postgresql.org ) is really intended for discussions of how to construct SQL queries to achieve desired results in a PostgreSQL database. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2:

Re: [SQL] Having difficulty writing a "best-fit" query..

2007-10-16 Thread Richard Broersma Jr
YMENT AGENCY PUZZLE http://www.elsevier.com/wps/find/bookdescription.cws_home/710075/description#description the only difference was that he was modeling employees and skillsets. IIRC, the terminology for the improved model was the "full disjuctive" model. Regards, Richard Broersma Jr. -

Re: [SQL] Need help with CASE statement in Function

2007-10-03 Thread Richard Broersma Jr
one without? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Many databases

2007-09-21 Thread Richard Broersma Jr
API on top of it that manages the data. Not a big deal but it > complicates things :-) The veil project already does this. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] Simple Query?

2007-09-11 Thread Richard Broersma Jr
1 > 3 3 > > > Now what I want to have is the items that match with id_search 1 and > 2 and 3. Therefore I use the following SQL query. SELECT id_search FROM Search_item GROUP BY id_search HAVING Count( * ) = 3

Re: [SQL] Cast on character columns in views

2007-09-04 Thread Richard Broersma Jr
u open psql -U your_db_user -d your_database_name. and type: \d schema_name.view_name was does it show as the definition of the column. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by

Re: [SQL] Cast on character columns in views

2007-09-04 Thread Richard Broersma Jr
ostgresql.org/docs/8.2/interactive/sql-createview.html I've created large SQL scripts that employ: DROP VIEW IF EXITS viewname; CREATE VIEW ... Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Cast on character columns in views

2007-09-03 Thread Richard Broersma Jr
le1.id > UNION ALL > SELECT table1.id, >table1.col1, >CAST( NULL AS CHARACTER( 3 )), >table3.type2 > FROM table1 > JOIN table3 ON table3.fk_table1 = table1.id; Would the above changes work? Regards, Richard Broersma Jr. ---(e

Re: [SQL] Constraints for grouping

2007-09-03 Thread Richard Broersma Jr
OOPS! --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > CREATE UNIQUE INDEX Only_one_row_true > ON Your_table ( featured ) >WHERE featured = true; > > Or if you want to only allow 1 featured article per catagory then: > > CREATE UNIQUE INDEX Onl

Re: [SQL] Constraints for grouping

2007-09-03 Thread Richard Broersma Jr
E featured = true; This will ensure that the sum( featured = true ) <= sum( unique( catagories )). Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-noma

Re: [SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Richard Broersma Jr
--- Alvaro Herrera <[EMAIL PROTECTED]> wrote: > Any function declared as returning SETOF RECORD needs it, when you don't > use OUT params. Before OUT params existed, it was the only way to use > those functions. Thanks everyone for the exposition! It makes sense. Regards,

[SQL] SELECT syntax synopsis: column_definition?

2007-08-21 Thread Richard Broersma Jr
alias [, ...] | column_definition [, ...] ) ]" Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Join question

2007-08-21 Thread Richard Broersma Jr
oops... I meant "DISTINCT ON ( a_id )" --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > SELECT a.x, b.x > FROM ( SELECT DISTINCT ON ( a_id ) a_id, b_id ^^ >FROM c ) AS c( a_id, b_id ) > INNER JOIN a >

Re: [SQL] Join question

2007-08-21 Thread Richard Broersma Jr
e_c_foreign_key ON c ( a, b ); SELECT a.x, b.x FROM ( SELECT DISTINCT( a_id ) a_id, b_id FROM c ) AS c( a_id, b_id ) INNER JOIN a ON c.a_id = a.id INNER JOIN b ON c.b_id = b.id; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] TRIGGERS and FUNCTIONS

2007-08-20 Thread Richard Broersma Jr
ot like an existing replication solution, "Slony". It will do exactly what you want, and is already stable for production systems. http://pgfoundry.org/projects/slony1/ Regards, Richard Broersma Jr. ---(end of broadcast)---

Re: [SQL] Problem with phone list.

2007-08-15 Thread Richard Broersma Jr
FROM your_view ORDER BY duration desc; or SELECT V1.id, V1.phone_number, V1.duration FROM your_view AS V1 INNER JOIN ( SELECT phone_number, max( duration ) FROM your_view GROUP BY phone_number ) AS V2( phone_number, duration ) ON (V1.p

Re: [SQL] Boolean without default declared

2007-08-15 Thread Richard Broersma Jr
I am not sure about the proper syntax for plpgsql. However, IS NULL is correct for sql statements. Also, don't forget to cc. the list so that other can chime in as well. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2:

Re: [SQL] Boolean without default declared

2007-08-15 Thread Richard Broersma Jr
known i.e. null. SELECT * FROM users WHERE happy IS NULL; UPDATE users SET happy = false WHERE happy IS NULL; ALTER TABLE USER ALTER COLUMN happy SET NOT NULL; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] data dependent sequences?

2007-07-17 Thread Richard Broersma Jr
t; > - with locking, lookup for last id of typ > > - with locking, keep another table of typ and nextval here is supplementary information of gap-less sequences: http://www.varlena.com/GeneralBits/130.php Regards, Richard Broersma Jr. ---(end of broadcast)

[SQL] tsearch2() trigger and domain types...

2007-06-18 Thread Michael D. Stemle, Jr.
but nothing seems to work. Anybody got any ideas? Thanks in advance. -- ~ Michael D. Stemle, Jr. <>< (A)bort, (R)etry, (I)nfluence with large hammer 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0 Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/p

Re: [SQL] [ADMIN] the right time to vacuum database?

2007-06-07 Thread osmar della paschoa jr
What's in your server? Osmar Della Paschoa Jr Software Engineer ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your messag

Re: [SQL] [GENERAL] CREATE RULE with WHERE clause

2007-06-05 Thread Richard Broersma Jr
se the where syntax in your query since it does not and cannot reference a NEW or OLD tuple. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] problems with SELECT query results

2007-05-29 Thread Richard Broersma Jr
efault value of zero for this column. ALTER TABLE Slparts ALTER COLUMN onorder SET NOT NULL, ALTER COLUMN onorder SET DEFAULT 0; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Whole-row comparison ?

2007-05-17 Thread Richard Broersma Jr
does. you have to specify every column that you want to compare, so: row(t.col1, t.col2, t.col3, t.col4) <> row(p.col1, p.col2, p.col3, p.col4) where the datatypes of each respective column match. i.e. t.col1 maps to p.col1, ... Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Whole-row comparison ?

2007-05-17 Thread Richard Broersma Jr
functions-comparisons.html#ROW-WISE-COMPARISON you can write something like: SELECT * FROM Your_table WHERE (c1,c2,c3,c4) = ('a',2,'xyz',123); Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading t

Re: [SQL] Temporal Table Relations and Referential Integrity

2007-05-14 Thread Richard Broersma Jr
e CREATE ASSERTION method will only prevent you from from altering the data in a way so as to make it inconsistent between the two tables. > [2](http://www.amazon.com/gp/product/1558608559/) I did purchase the Chris Date book, but I haven't spend any time reading it since its illus

[SQL] Temporal Table Relations and Referential Integrity

2007-05-07 Thread Richard Broersma Jr
Temporal Referential-Integrity (RFI) if my questions are unclear. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate

Re: [SQL] Insert into VIEW using RULE. Not possible to use nextval()?

2007-05-04 Thread Richard Broersma Jr
code: //This will always work: For i = 1 to 1000 do INSERT INTO Vschematic VALUES ( .. some unique values .. ); Next i //These will always fail: INSERT INTO Vschematic SELECT * FROM A_TABLE LIMIT 1000; or INSERT INTO Vschematic VALUES ( unique vals 1),(unique vals 2), ..., (unique vals n); Reg

Re: [SQL] Insert into VIEW using RULE. Not possible to use nextval()?

2007-05-03 Thread Richard Broersma Jr
27;pid', 'isometric', 'airsupplydetail', 'mountingdetail', 'pnuematicdetail'))) ; CREATE TABLE docs.schematic ( did integer primary key references docs.drawing(did) on delete cascade, doccode varchar(30) not null, cid integer references equ.lcp(cid), constraint schematic_doccode_chk check ( doccode = 'schematic')) ; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Insert into VIEW using RULE. Not possible to use nextval()?

2007-05-03 Thread Richard Broersma Jr
--- Collin Peters <[EMAIL PROTECTED]> wrote: > I am having the same problem that is documented elsewhere in the > archives. Namely when you have a INSERT RULE on a VIEW the nextval() > function doesn't behave properly (or it doesn't behave how I'd like it > to). > > http://archives.postgresql.o

Re: [SQL] Joe Celko's method to "generate_series" not working?

2007-05-02 Thread Richard Broersma Jr
--- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > Is Mr. Celko mistaken? Does anyone know if PostgreSQL has any functions that > I can turn these > VALUES rows into columns so that the CROSS JOINS will work? Having posted, I just realized what the correct syntax is:

[SQL] Joe Celko's method to "generate_series" not working?

2007-05-02 Thread Richard Broersma Jr
s, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Floating point type to store numbers

2007-04-17 Thread Richard Broersma Jr
/interactive/datatype-numeric.html#DATATYPE-FLOAT I didn't see anything about numeric being a string type, http://www.postgresql.org/docs/8.2/interactive/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL Regards, Richard Broersma Jr. ---(end of broadcast)--

Re: [SQL] Very slow DELETE on 4000 rows of 55000 row table

2007-04-04 Thread Richard Broersma Jr
> But I DELETE all conflicting those rows prior to the slow DELETE, just > so the FK check is never hit. Should I be looking at subverting the FK > check mechanism somehow? The necessary index would be huge, and > relevant only on this particular operation which happens every few > months, if tha

Re: [SQL] Moving a simple function to pl/pgsql (Novice question)

2007-04-04 Thread Richard Broersma Jr
ger.html#PLPGSQL-TRIGGER-AUDIT-EXAMPLE One other point to be aware of, Postgresql does not allow your to reference other databases in the DB-cluster directly. It is possible but you need to add a contrib module called dblink: http://pgfoundry.org/projects/snapshot/ Hope this helps, Rega

Re: [SQL] Serial

2007-04-03 Thread Richard Broersma Jr
sequential numbers, or is just something that > feels good / looks good? The following link develops the use of a gapless sequence: http://www.varlena.com/GeneralBits/130.php Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Temp tbl Vs. View

2007-03-29 Thread Richard Broersma Jr
for more extended queries? Any other design ideas? Perhaps tsearch2 would work for you. I am just starting to learn about it. Maybe you can create a tsearch2 GIN index on each table in the view, and then use tsearch2 queries to quickly retrieve your results. Regards, R

Re: [SQL] union with count?

2007-03-28 Thread Richard Broersma Jr
--- Gerardo Herzig <[EMAIL PROTECTED]> wrote: > Hi dudes, i have the following question > i have 2 tables with the same format, and i want to know if is there a > possibility of using some sort of count(*) for achieving this result: > select a from table1 where (condition) union select a from ta

Re: [SQL] Regular Expressions [progress]

2007-03-28 Thread Richard Broersma Jr
> Select * from myAddressTable where address similar to ('%(ELMO|ST.|258)%') > > But I still need to Separete all strings. What is it that you are trying to achieve? What string would you like to seperate? Regards, Richard Broersma Jr. -

Re: [SQL] Regular Expressions

2007-03-27 Thread Richard Broersma Jr
es we can find 'Elmo', 'Street'. > select zipcode from zipzodetable where address ~ 'Elmo' and address ~ 'Street'; If the query is too slow I expect that installing the tsearch2 contrib module and using the tsearch2 type queries would give you want

Re: [SQL] Subqueryes

2007-03-22 Thread Richard Broersma Jr
Add FROM Table1 B WHERE myFKey_id = B.Table1Id; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] INSERT INTO

2007-03-16 Thread Richard Broersma Jr
> INSERT INTO TABLE2 (TE_INDI) VALUES ($SANT'ANGELO LODIGIANO$); My mistake, a single $ will not work you need two like $$: INSERT INTO TABLE2 (TE_INDI) VALUES ($$SANT'ANGELO LODIGIANO$$); Regards, Richard Broersma Jr. ---(end

Re: [SQL] INSERT INTO

2007-03-16 Thread Richard Broersma Jr
using PostgreSQL >= 8.0 you can use dollars sign quoting like the following: INSERT INTO TABLE2 (TE_INDI) VALUES ($SANT'ANGELO LODIGIANO$); or even a custom quotation identifier: INSERT INTO TABLE2 (TE_INDI) VALUES ($myquote$SANT'ANGELO LODIGIANO$myquote$); Would

Re: [SQL] inheritance

2007-03-08 Thread Richard Broersma Jr
another table. Before this, I think table inheritance could only be created from the CREATE TABLE statement. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nom

Re: [SQL] inheritance

2007-03-08 Thread Richard Broersma Jr
ere is a better way of doing it. ;) Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] A form of inheritance with PostgreSQL

2007-03-08 Thread Richard Broersma Jr
ing views made update-able with the Postgresql rule system. Here is a link were I present how it is done. http://archives.postgresql.org/pgsql-general/2006-12/msg00913.php Let me know if you have any questions. Regards, Richard Broersma Jr. ---(en

Re: [SQL] Inc

2007-03-06 Thread Richard Broersma Jr
--- Ezequias Rodrigues da Rocha <[EMAIL PROTECTED]> wrote: > Thank you but I must inc an specific row. How to do that ? > Does, UPDATE your_table SET your_row = your_row +1 WHERE your_pkey = ; not do what you need? Regards, Richard Broersma Jr. ---(end

Re: [SQL] select based on multi-column primary keys

2007-01-19 Thread Richard Broersma Jr
g modeled. :-) Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] deleting records from a table

2007-01-12 Thread Richard Broersma Jr
scribes its use: http://www.postgresql.org/docs/8.2/interactive/app-reindexdb.html Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] deleting records from a table

2007-01-12 Thread Richard Broersma Jr
UUM FULL & possible REINDEX. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] how un-suscribe from this list

2007-01-08 Thread Richard Broersma Jr
ng line: List-Unsubscribe: [EMAIL PROTECTED] Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Need to subtract values between previous and current row

2006-12-15 Thread Richard Broersma Jr
gt; 102 |2 | 1 > 102 |2 | 2 > 102 |2 | 3 > (7 rows) Good catch! I should have read the requirements a little more closely, but at 4:30 am when I just woke up, slight details are very hard for me to focus on. :o) Regards, Richard Broersma Jr.

Re: [SQL] Need to subtract values between previous and current row

2006-12-15 Thread Richard Broersma Jr
> CIDATIME STATE > 10112/10/2006 1 > 10112/12/2006 2 > 10112/14/2006 1 > 10112/17/2006 2 > 10212/14/2006 1 > 10212/16/2006 2 > 10212/18/2006 3 select A.cid, (A.atime - max(B.atime)) duration, A.sta

Re: [SQL] Need to subtract values between previous and current row

2006-12-15 Thread Richard Broersma Jr
> row3 and so on... just an idea. select (A.atime - max(B.atime)) duration from table A join table B on (A.atime > B.atime) group by A.atime; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our

Re: [SQL] I don't want receive more emails

2006-12-05 Thread Richard Broersma Jr
> hi, could you tell me, what have I do for not reveice more emails Send an email to: [EMAIL PROTECTED] Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating

Re: [SQL] Can someone explain the problem with this select

2006-12-05 Thread Richard Broersma Jr
anything else with it. select * from ( select doc_num from documents limit 10 ) as D1 left outer join comments on (D1.doc_num = comments.doc_num) ; Regards, Richard Broersma Jr. ---(end of broadcast)

Re: [SQL] Using Control Flow Functions in a SELECT Statement

2006-12-04 Thread Richard Broersma Jr
> Thanks FOR your prompt responseBut USING CASE issue still NOT resolved > Oracle prompts same error. I see, was answers to you get from the oracle mailing lists regarding this problem? ;o) Regards, Richard Broersma Jr. ---(end of bro

Re: [SQL] Using Control Flow Functions in a SELECT Statement

2006-12-04 Thread Richard Broersma Jr
not believe that the "IF" predicate exists. However the "CASE" predicate does and will do what you want. http://www.postgresql.org/files/documentation/books/aw_pgsql/node44.html Regards, Richard Broersma Jr. ---(end of broadcast)--

Re: [SQL] Setting boolean column based on cumulative integer value

2006-12-01 Thread Richard Broersma Jr
ger record because he/she wishes to get off early you will need to have an additional update statement to shift down higher valued records insure that the range does not have any gaps. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] SQL command join question

2006-11-29 Thread Richard Broersma Jr
can refer to any of it's enternal tables any more. So (t1.c=...) should really be (t.c=...). this is what I expect would work: select * from t1 left outer join t2 on ((t1.a,t1.b) = (t2.a,t2.b)) left outer join t3 on (t1.c = t3.c) ; Regards,

Re: [SQL] select into

2006-11-22 Thread Richard Broersma Jr
yet when it comes PL/pgsql. Thanks for the clarification. Regards, Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] select into

2006-11-22 Thread Richard Broersma Jr
eractive/sql-selectinto.html and particularly this example: http://www.postgresql.org/docs/8.2/interactive/sql-selectinto.html#AEN54014 Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] sql problem with join

2006-11-15 Thread Richard Broersma Jr
and then make up some results that you would really like to get. I am not entirely clear what you are trying to achieve. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] unexpected EOF within message length word

2006-11-14 Thread Richard Broersma Jr
> I'm having trouble getting the Windows ODBC drivers to work. They used > to work, but it's been 6 months or so. If you don't find the answer you are looking for on this list, maybe try: [EMAIL PROTECTED] Regards, Richard Broersma Jr. ---

Re: [SQL] Another question about composite types

2006-11-13 Thread Richard Broersma Jr
ve do it ? Why not use a conventional table to hold this information that references your employee table? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: RES: [SQL] Inserting data in composite types!

2006-11-13 Thread Richard Broersma Jr
> Thanks, It works! I have tried: > > insert into employee (c, nome, sal) values(1, 'emp name', '(1, (01/01/2000, > 01/01/2000))' ); > > And it doesn't work! What is the error message? Regards, Richard Broersma Jr. -

Re: [SQL] PostgesSQL equivalent of the Oracle 'contains' operator

2006-11-10 Thread Richard Broersma Jr
an a like. Have you looked at the contrib module tsearch2? http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/ Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subs

Re: [SQL] converting Informix outer to Postgres

2006-11-06 Thread Richard Broersma Jr
nv_id = i.id and > --mdef2.id = im2.milestone_id and > im1.datereceived IS NULL Is there a reason that these two lines are commented out in the postgresql query? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] Requirement for PostgreSQL Database Developer

2006-11-06 Thread Richard Broersma Jr
Thanks for I think the list that you are looking for is: [EMAIL PROTECTED] --- Mark <[EMAIL PROTECTED]> wrote: > > Hi , > > > Location: San Diego, CA [You can also TeleCommute...] > > Duration: 6+ months. > > > > This is Mark with ProV International, This email is in regards to

Re: [SQL] fetching unique pins in a high-transaction environment...

2006-11-06 Thread Richard Broersma Jr
ross transactions or even user sessions. I was curious of the datatype for pin, in the previous example I think that it was defined as a varchar. Perhaps casting the sequence to a varchar would be the finial step before updating/inserting the records. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Groups and Roles and Users

2006-11-06 Thread Richard Broersma Jr
ql.org/docs/8.1/interactive/user-manag.html http://www.postgresql.org/docs/8.1/interactive/client-authentication.html Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] a celko-puzzle from long time ago

2006-11-06 Thread Richard Broersma Jr
s that describe how to set parameter variables before executing a query that uses them. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to

Re: [SQL] Duplicate Fields + Views Questions

2006-11-03 Thread Richard Broersma Jr
OM gnis_international_view, > gnis_usa_view; > ERROR: column "the_geom" duplicated > ERROR: column "the_geom" duplicated > > Any ideas on how I can achieve what I am seeking Yes but you will have to specify each column name from each table and create alias

Re: [SQL] Add calculated fields from one table to other table

2006-11-02 Thread Richard Broersma Jr
GROUP BY A.ric, A.minute ORDER BY A.minute ; Hope this is what you were looking for. This is the first time I've ever had to employ a cross join get what I wanted. Just realize that this query will explode with a very large number to records returned as the times

Re: [SQL] Add calculated fields from one table to other table

2006-10-31 Thread Richard Broersma Jr
> Hi Richard, > > Thanks a lot. I still am not able to get the result for all the rics in the > ticks table but I > am able to get the result for a particular ric. > > Can you help me with getting the result for all the rics in the ticks table > > Thanks > Roopa Could you send

Re: [SQL] Add calculated fields from one table to other table

2006-10-31 Thread Richard Broersma Jr
> Thanks for your help. That does make sense, but I am not able to get the > result what I wanted > exactly. Let me explain you. > > I have ticks table in which I have columns like ric, tick_time, price & > volume. The times > table has just one column with times_time which has time data

Re: [SQL] Add calculated fields from one table to other table

2006-10-30 Thread Richard Broersma Jr
n-joined tables contrainst AND A.id2 < C.id2 ; --in the where clause I hope this helps. Regards, Richard Broersma JR. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate sub

Re: [SQL] Add calculated fields from one table to other table

2006-10-29 Thread Richard Broersma Jr
re interested in and outer join that to your actual table. This will give you a count of zero. i.e. select S.minute, count(W.minute) as minutecnt from Series_of_Minutes S left join Working_table W on S.minute = W.minute ; hope this helps. REgards, Richard Broersma jr. ps. sorry that my quer

Re: [SQL] Case Preservation disregarding case sensitivity?

2006-10-28 Thread Richard Broersma Jr
oo should be equivalent to "FOO" not "foo" according to the standard. If you want to write portable applications you are advised to always quote a particular name or never quote it.) ... Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Case Preservation disregarding case sensitivity?

2006-10-28 Thread Richard Broersma Jr
r a way (magic, patches, whiskey, etc) that will give > me > case-preservation with EITHER case-sensitivity OR case-insensitivity, but not > both as I am seeing. Perhaps in your queries or views you use the AS keywork to respecify the column name with upper/

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread Richard Broersma Jr
t; Again, thanks for the help. psql -l Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] Add calculated fields from one table to other table

2006-10-26 Thread Richard Broersma Jr
avg(price) as avg_price, avg(volume) as avg_volume from ticker where time between 'yourstartdate' and 'yourenddate' group by tick, minute; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

  1   2   >