[GENERAL] Complex case statement

2013-07-05 Thread Greenhorn
Hi All, I have three tables. Table: transaction meter_id | bay_number | trans_date_time | amount --+++ 1078 | 5 | 2013-06-03 09:59:32+10 | 5.00 1078 | 7 | 2013-06-03 09:12:01+10 | 5.00

[GENERAL] Finding duplicates only.

2010-03-10 Thread Greenhorn
Hi, Can someone please help me with this duplicate query. I'm trying to: 1. Return duplicates only. (without including the first valid record), and 2. Return as duplicate if the difference between a.inspection_time and b.inspection time is under 5 minutes. Here's the query string I'm using to

Re: [GENERAL] left join count

2010-02-11 Thread Greenhorn
On 12 February 2010 10:28, Richard Huxton wrote: > On 11/02/10 22:53, Greenhorn wrote: >> >> But I seem to be getting (after the join) the sum of amount x count of >> notes.  Can someone enlighten me with this problem? > >> select >>   energy_accounts

[GENERAL] left join count

2010-02-11 Thread Greenhorn
Hi All, I'm trying to retrieve the count of notes associated for each transactions for table energy_transactions. But I seem to be getting (after the join) the sum of amount x count of notes. Can someone enlighten me with this problem? Here's the query that I am working with. select energy_acco

Re: [GENERAL] cross-database time extract?

2009-12-28 Thread Greenhorn
2009/12/29 Israel Brewster : > > On Dec 24, 2009, at 12:53 PM, Adrian Klaver wrote: > >> On Thursday 24 December 2009 1:44:58 pm Israel Brewster wrote: >>> >>> This is sort of a PostgreSQL question/sort of a general SQL question, >>> so I apologize if this isn't the best place to ask. At any rate,

Re: [GENERAL] Concurrency issue under very heay loads

2009-07-15 Thread Greenhorn
2009/7/16 Raji Sridar (raji) : > Hi, > > We use a typical counter within a transaction to generate order sequence > number and update the next sequence number. This is a simple next counter - > nothing fancy about it.  When multiple clients are concurrently accessing > this table and updating it, u

[GENERAL] bash & postgres

2009-03-22 Thread Greenhorn
Hi, I'm trying to pass variables on a bash script embedded with psql commands. cat header.txt "to1","from1","subject1" "to2","from2","subject2" "to3","from3","subject3" "to4","from4","subject4" cat b.sh #!/bin/bash two="2" psql -h localhost -U postgres -d mobile -c "create temp table header (

[GENERAL] Oracle to PostgreSQL

2009-03-15 Thread Greenhorn
Hi, I have almost 1300 files from Oracle (no access to oracle server). I have to create the tables and data as follows. -- start script -- file name: aa_asset_type.sql CREATE TABLE AS_ASSET_TYPE ( MAIN_TYPE CHAR(3) NOT NULL, SUB_TYPE NUMBER(3)