Re: [SQL] simple problem???

2006-07-21 Thread Patrick Jacquot
ivan marchesini wrote: Dear users It's a simple problem I think (and I hope :-) I have a table like this: A|B|C 1|2|20 1|3|10 1|4|21 2|3|12 2|4|22 3|4|23 where the first two column are a combination without repetition (with k=2) of the numbers 1,2,3,4 for each pair I have a value in the c

Re: [SQL] graph plottin engines compatible with postgres

2006-07-03 Thread Patrick Jacquot
Parang Saraf wrote: hey, I wanted to know about graph plotting engine that is compatible with postgres 8.1.4. I am performing some queries like : Comparing the speed of three runners namely A, B and C versus time. I want to publish the result in a graphical manner on the net instead of just

Re: [SQL] "CASE" is not a variable

2006-06-29 Thread Patrick Jacquot
Keith Worthington wrote: Hi All, The following is a section of code inside an SQL function. When I attempt to run it I get the error message '"CASE" is not a variable'. If I split this into two queries (one for each variable) it works fine. Obviously I have a work around but I would like to

Re: [SQL] Am I crazy or is this SQL not possible

2006-06-02 Thread Patrick Jacquot
Collin Peters wrote: I am having some serious mental block here. Here is the abstract version of my problem. I have a table like this: unique_id (PK) broadcast_id date_sent status 1 1 2005-04-0430 2 1

Re: [SQL] some error when executing query in pgAdmin tool

2006-05-23 Thread Patrick JACQUOT
Penchalaiah P. wrote: I created one table in pgAdmin tool but when I am executing query it is giving error…. CREATE TABLE "ADV" ( "T-Section_Id" varchar(10) NOT NULL, "CDA_No" varchar(7) NOT NULL, "Imp_Schedule_Id" int4 NOT NULL, "Sanction_No" varchar(20) NOT NULL, "Sanction_Date" date N

Re: [SQL] insert related data into two tables

2006-05-22 Thread Patrick JACQUOT
[EMAIL PROTECTED] wrote: Hello, I have two tables like these: TABLE_1: people registry fields: ID_T1, SURNAME, NAME ID_T1 is primary key TABLE_2: work groups fields: ID_T2, TASK ID_T2 is foreign key related to ID_T1 the first table is the list of employees, the second the task. Sometime I

Re: [SQL] Referential integrity broken (8.0.3), sub-select help

2006-03-22 Thread Patrick JACQUOT
[EMAIL PROTECTED] wrote: Hello, I've got 2 tables, "url" (U), and "bookmark" (B), with "bookmark" pointing to "url" via FK. Somehow I ended up with some rows in B referencing non-existent rows in U. This sounds super strange and dangerous to me, and it's not clear to me how/why PG let this ha

Re: [SQL] Need help: Find dirty rows, Update, Delete SQL

2006-02-20 Thread Patrick JACQUOT
Janning Vygen wrote: Am Samstag, 18. Februar 2006 18:41 schrieb [EMAIL PROTECTED]: Hello, I need a bit of help with some SQL. I have two tables, call them Page and Bookmark. Each row in Page can have many Bookmarks pointing to it, and they are joined via a FK (Page.id = Bookmark.page_id).

Re: [SQL] SELECT on a to-be-determined table

2006-02-20 Thread Patrick JACQUOT
garhone wrote: Hi, I'm a new at this. So please forgive if I mess up. Also, if there is already a reference/tutorial somewhere, feel free to point me to it. Here's my situation: db=# select * from projects; projid | projname +-- 1 | cars 2 | houses 3 | pets (3 ro

Re: [SQL] Non Matching Records in Two Tables

2006-02-09 Thread Patrick JACQUOT
Ken Hill wrote: I need some help with a bit of SQL. I have two tables. I want to find records in one table that don't match records in another table based on a common column in the two tables. Both tables have a column named 'key100'. I was trying something like: SELECT count(*) FROM table1,

Re: [SQL] problem referencing an attrib which is not unique

2006-02-07 Thread Patrick JACQUOT
Vic Rowan wrote: -- Forwarded message -- From: *Vic Rowan* <[EMAIL PROTECTED] > Date: Feb 7, 2006 2:31 PM Subject: problem referencing an attrib which is not unique To: pgsql-sql@postgresql.org hello everybody, I ne

Re: [SQL] Matching several rows

2006-01-18 Thread Patrick JACQUOT
Michael Glaesemann wrote: On Jan 18, 2006, at 21:48 , Volkan YAZICI wrote: AFAICS, the bottleneck in above query is ANY(ARRAY[]) clause usage. Instead of that, if you replace «rights = ANY(ARRAY[2,5,10])» with «rights IN (2,5,10)» it's overhead decreases to 0.200-0.300ms domain. explain an

Re: [SQL] Need SQL Help Finding Current Status of members

2005-12-16 Thread Patrick JACQUOT
Richard Huxton wrote: Michael Avila wrote: I have a table which keeps track of the status of members. In the table is member_id int(8) status_code char(1) status_date date KEY member_id (member_id,status_code,status_date) Each member can have multiple records because a record is added each

Re: [SQL] RETURN SET OF DATA WITH CURSOR

2005-12-16 Thread Patrick JACQUOT
grupos wrote: Hi Richard, Thanks for your promptly answer. I don't have experience returning refcursor but my choice would be it. I read the documentation but I didn't find any example with my necessity... Could you give me a small example on the same "basis" that I want? Thanks, Rodrigo

Re: [SQL] Just 1 in a series...

2005-12-05 Thread Patrick JACQUOT
Mark Fenbers wrote: What would have to be done if I needed a standard SQL solution? Mark ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org Maybe you could t'ry something like : Se

Re: [SQL] automatic update or insert

2005-10-26 Thread Patrick JACQUOT
tobbe wrote: Hi. I have a little problem. In a system of mine i need to insert records into table [tbStat], and if the records exist i need to update them instead and increase a column [cQuantity] for every update. I.e. the first insert sets cQuantity to 1, and for every other run cQuantity i

Re: [SQL] Please help me to slove this SQL statements

2003-11-05 Thread Patrick JACQUOT (DSI NOISIEL)
-Message d'origine- De : Freshman [mailto:[EMAIL PROTECTED] Envoyé : jeudi 30 octobre 2003 13:38 À : [EMAIL PROTECTED] Objet : [SQL] Please help me to slove this SQL statements There are three table in database which is suppliers, projects, and shipments suppliers contain suppliers id,

[SQL] referencing oid impozsible ?

2001-09-11 Thread patrick . jacquot
hello all I tried recently (pgsql 7.1.2) to establish the oid of one table as foreign key in another. To no avail : there was no uniqueness constraint on that column Naturally, it seems impossible to add a uniqueness constraint to such a system column. As far as i know, the oid is by nature uniqu

Re: [SQL] Comparing dates

2001-03-06 Thread patrick . jacquot
Markus Fischer wrote: > Hello, > > I've a SELECT statement on many joined Tabled and one of them has > a date column called 'date_date'. When I fetch a date e.g. > '02-03-2001', I get, say, 60 results back. When I now perform the > same query with another date, lets take '03-03-2001', I get back

Re: [SQL] select returns no line

2001-01-23 Thread patrick . jacquot
Attila Kevei wrote: > Hi, > > Our database has a SELECT problem using varchar columns in WHERE clause > (but not in all rows!!!). > We can fix the whole table (or just the row) as shown below but later it > seems wrong again (and after the fix the row isn't UPDATEd). > > Any idea? > > Thanks >

Re: [SQL] Query Help

2000-12-28 Thread patrick . jacquot
"Brian C. Doyle" wrote: > What do I have to do a query where information in table1 is not in table2 > > I am looking for something like > > Select table1.firstname where table1.firstname is not in table2.firstname > and table2.date='yesterday' > > I tried > Select table1.firstname where table1.fi

[SQL] subqueries as values in updates

2000-12-08 Thread patrick . jacquot
hello, list. are subqueries alloved as values in an update command ? e.g. update a set a.attribute1 = a.attribute1 + (select sum(b.attribute1) from b where b.attribute2=a.attribute2); If yes, how is the correct syntax ? If not, is there a hope for it in a future version ?

Re: [SQL] join if there, blank if not

2000-07-13 Thread Patrick Jacquot
Henry Lafleur wrote: > Jacques, > > The problem with using the union in this way is that you get NULLs for a > number weather or not it has an associated record in calls. > > To do a pure outer join, it would be something like this: > > select c.cdate, c.ctime, c.cextn, c.cnumber, n.ndesc > from

Re: [SQL] confused by select.

2000-07-07 Thread Patrick Jacquot
is 2.? but there are many > orders with hundreds of items. > > Sorry for the long winded explanation. > But I figured, that the more imformation i gave, the more someone may be > able to help. > > Thanks in advance. > .jtp usually many-to-many relationships are handled by a third table, like this: create table items (item_id,...) create table customers (customer_id, ...) create table orders (customer_id, item_id, quantity_orderered) Hoping it may help Patrick JACQUOT

Re: [SQL] GROUP by finish&&last day of month

2000-07-05 Thread Patrick Jacquot
Antti Linno wrote: > Ok, if I want to get non-aggregat data in groups, I use order by. This > group by seemed so logical though, but the fruit that u can't have, is > usually the most sweet. > > New question, how to get the last day of month(order data by last day of > month). And to prevent chai