Re: [SQL] sql query problem

2012-01-17 Thread David Johnston
On Jan 17, 2012, at 8:35, Andreas Kretschmer wrote: > Alok Thakur wrote: > >> Dear, >> >> I am trying to provide you as much details as possible. >> >> answer` ( >> `id` int(10) NOT NULL AUTO_INCREMENT, >> `question_id` int(10) NOT NULL, >> `user_id` int(10) NOT NULL, >> `answer` int(10)

Re: [SQL] sql query problem

2012-01-17 Thread Andreas Kretschmer
Alok Thakur wrote: > Dear, > > I am trying to provide you as much details as possible. > > answer` ( > `id` int(10) NOT NULL AUTO_INCREMENT, > `question_id` int(10) NOT NULL, > `user_id` int(10) NOT NULL, > `answer` int(10) NOT NULL, -> > `status` tinyint(1) NOT NULL, --> Status wil

Re: [SQL] sql query problem

2012-01-17 Thread Alok Thakur
FROM > UserTable INNER JOIN result ON UserTable.id = result.user_id > > Sent from my Windows Phone > From: Alok Thakur > Sent: 15/01/2012 22:08 > To: pgsql-...@postgresql.org > Subject: [SQL] sql query problem > Dear All, > > I have two tables one contains details of user an

Re: [SQL] Query Problem... Left OuterJoin / Tagging Issue

2012-01-17 Thread John Tuliao
Thank you so much for your prompt reply David. I will consider your advice and put it to mind and action. I hope you all don't get tired of helping! For now, I will note down what I need to and do the necessary adjustments. Thank you for your time! On Friday, 13 January, 2012 10:26 PM, David

Re: [SQL] sql query problem

2012-01-15 Thread Misa Simic
result.user_id Sent from my Windows Phone From: Alok Thakur Sent: 15/01/2012 22:08 To: pgsql-sql@postgresql.org Subject: [SQL] sql query problem Dear All, I have two tables one contains details of user and other contains result. The details are: 1. UserTable - id, name, phone 2. result - id,

Re: [SQL] sql query problem

2012-01-15 Thread Oliveiros
What does a 0 state mean? Failed? And a 1 state? Passed? Best, Oliveiros 2012/1/14 Alok Thakur > Dear All, > > I have two tables one contains details of user and other contains > result. The details are: > 1. UserTable - id, name, phone > 2. result - id, question_id, user_id, status (0 or 1) >

[SQL] sql query problem

2012-01-15 Thread Alok Thakur
Dear All, I have two tables one contains details of user and other contains result. The details are: 1. UserTable - id, name, phone 2. result - id, question_id, user_id, status (0 or 1) I want the list like this: User Id Name Attended Failed Passed but i could not find the way to do this

Re: [SQL] Query Problem... Left OuterJoin / Tagging Issue

2012-01-13 Thread David Johnston
On Jan 12, 2012, at 23:31, John Tuliao wrote: > Hi, > > I've been working on this for quite awhile now and don't seem to get the > proper query. > > I have basically 4 tables. > > 1. Table john_test contains the numbers of the calls. > 2. Table john_country contains the country with prefix.

[SQL] Query Problem... Left OuterJoin / Tagging Issue

2012-01-12 Thread John Tuliao
Hi, I've been working on this for quite awhile now and don't seem to get the proper query. I have basically 4 tables. 1. Table john_test contains the numbers of the calls. 2. Table john_country contains the country with prefix. 3. Table john_clients contains the clients and their sub_id's

Re: [SQL] Query Problem from FoxPro???

2007-07-03 Thread dBHS Jakarta
Dear All, It turns out that, column "is_pilih" was written with "Is_Pilih". PostgreSQL column name is case sensitive! After I change the column name to "is_pilih" everything's showed up! Another NEW Question arose: "Why the is_pilih data type become Character when it displayed in VFP?" Anybod

Re: [SQL] Query Problem from FoxPro???

2007-06-30 Thread Jaime Casanova
On 7/1/07, dBHS Jakarta <[EMAIL PROTECTED]> wrote: I try to query from FoxPro via ADODB, Recordset using this SelectCmd: "SELECT * FROM mst_lang" Everything is showed. When I try to query using: "SELECT lang_id, lang_nm, is_pil FROM mst_lang" No Results showed... Does anybody know what's the p

[SQL] Query Problem from FoxPro???

2007-06-30 Thread dBHS Jakarta
Dear all, I am try to migrate from VFP back-end database to PostgreSQL. Table: mst_lang Columns: lang_id Char (2) lang_nm Char (20) is_pil Boolean I try to query from FoxPro via ADODB, Recordset using this SelectCmd: "SELECT * FROM mst_lang" Everything is showed. Whe

Re: [SQL] Query Problem

2005-04-07 Thread Richard Huxton
Abdul Wahab Dahalan wrote: If I've 2 tables like this: Country table : with 2 fields (country and id) Country id EnglandE France F JapanJ FlightTo table : with 2 fields(Flight ID and Destination) FlightIDDestination B1

[SQL] Query Problem

2005-04-07 Thread Abdul Wahab Dahalan
If I've 2 tables like this: Country table : with 2 fields (country and id) Country id EnglandE France F JapanJ FlightTo table : with 2 fields(Flight ID and Destination) FlightIDDestination B1 E,J B2

Re: [SQL] Query Problem

2003-11-10 Thread Joe Conway
Abdul Wahab Dahalan wrote: If I've a table like below. kk kjpngkvote 01 02 c 10 01 02 b 5 How do I make a query so that I can get a result like this? kk kjpngkvote 01 02c,b 15 create or replace function accum_text(tex

[SQL] Query Problem

2003-11-10 Thread Abdul Wahab Dahalan
Hi there! If I've a table like below. kk kj pngk vote 01 02 c 10 01 02 b 5 How do I make a query so that I can get a result like this? kk kj pngk vote 01 02 c,b 15 Any help pretty much appreciated. -

[SQL] query problem

2003-11-08 Thread ron_tabada
Hello everyone, Good day! Could anyone help me translate this query in Microsoft Access to Postgresql. I'm having a difficulty. Pls... Query1:SELECT items.description, Sum(supplieditems.qty) AS SumOfqtyFROM items INNER JOIN supplieditems ON items.itemno = supplieditems.itemnoGROUP BY items.descript

Re: [SQL] [GENERAL] SQL query problem (many table in FROM statement and many LEFT JOIN's)

2003-10-14 Thread Tom Lane
"Marek Lewczuk" <[EMAIL PROTECTED]> writes: > ... It also working fine. The question is, why my first query isn't > working: > SELECT > _CON.con_id, > _MOD.mod_ty, > _VER.version, > _YEA.year, > _CON.dri_id, > _CON.man_cod, > _ENG.eng_pow > FROM > db_data.mda_mod _MOD, > db_

Re: [SQL] [GENERAL] SQL query problem (many table in FROM statement and many LEFT JOIN's)

2003-10-10 Thread Richard Huxton
On Friday 10 October 2003 08:53, Marek Lewczuk wrote: > > > SELECT > > > _CON.con_id, > > > > Please make sure you get the quoting right regarding table > > names. PostgreSQL will fold _CON into _con unless quoted > > "_CON". So, it may be that you created the table with quotes > > ("_CON"). Now,

Re: [SQL] [GENERAL] SQL query problem (many table in FROM statement and many LEFT JOIN's)

2003-10-09 Thread Marek Lewczuk
> > SELECT > > _CON.con_id, > Please make sure you get the quoting right regarding table > names. PostgreSQL will fold _CON into _con unless quoted > "_CON". So, it may be that you created the table with quotes > ("_CON"). Now, in your query you don't use quotes and thusly > it is looking for

Re: [SQL] SQL query problem

2003-10-09 Thread Stuart Barbee
Marek, Not sure but, try switching the lines db_data.mda_mod_con _CON, db_data.set_mda_fue _FUE with db_data.set_mda_fue _FUE, db_data.mda_mod_con _CON so there query is: SELECT _CON.con_id, _MOD.mod_ty, _VER.version, _YEA.year, _CON.dri_id, _CON.man_cod, _ENG.eng_p

Re: [SQL] SQL query problem

2003-10-09 Thread Bruno Wolff III
On Thu, Oct 09, 2003 at 20:52:58 +0100, Marek Lewczuk <[EMAIL PROTECTED]> wrote: > Hello, > I'm in the middle of the migration process from MySQL to PostgreSQL and > I cannot understand why this query isn't working (in MySQL it's working > fine). PG returns: ERROR: Relation "_con" does not exist

[SQL] SQL query problem

2003-10-09 Thread Marek Lewczuk
Hello, I'm in the middle of the migration process from MySQL to PostgreSQL and I cannot understand why this query isn't working (in MySQL it's working fine). PG returns: ERROR: Relation "_con" does not exist This is my query: SELECT _CON.con_id, _MOD.mod_ty, _VER.version, _YEA.year, _C

Re: [SQL] Query problem

2003-08-19 Thread Bruno Wolff III
On Tue, Aug 19, 2003 at 15:02:24 +0200, Rado Petrik <[EMAIL PROTECTED]> wrote: > > In programing language output = > > id(1..3) { > $output = ( bit | $output ); > } > > How write query ? . Thanks You probably want to write a custom aggregate function to do this.

[SQL] Query problem

2003-08-19 Thread Rado Petrik
Hi, I have table "user". table "user" id bit(dec)bit(bin) - 1 1 1 2 311 3 12 1100 and I need query - > SELECT "output" FROM user WHERE id = 1 OR id = 2 or id = 3 output = () In programing lan

[SQL] query problem "server sent binary data ... without prior row description ..."

2002-09-27 Thread jonesbl
I'm having a problem with postgres on HPUX. My version is: VERSION = 'PostgreSQL 7.2.2 on hppa2.0w-hp-hpux11.11, compiled by aCC -Ae' I'm trying to do a query and it consistently gives the following errors: wily=# \a

Re: [SQL] query problem

2002-08-30 Thread Jean-Luc Lachance
I think you meant min(date)... Josh Berkus wrote: > > Marco, > > > Is there a way to obtain this records by performing one > > single query and not by making for each city something like > > "SELECT city,date FROM table WHERE city='London' AND date>'2002-07-19 > > 15:39:15+00' ORDER BY date AS

Re: [SQL] query problem

2002-08-30 Thread Jean-Luc Lachance
How about: select city, min(date) from thetable where date > '2002-07-19 15:39:15+00' group by city; JLL Marco Muratori wrote: > > Hi > suppose I have the following situation: > > citydate > -+--- > London | 2002-08-08 07:05:16+00 > London | 2002

Re: [SQL] query problem

2002-08-30 Thread Josh Berkus
Marco, > Is there a way to obtain this records by performing one > single query and not by making for each city something like > "SELECT city,date FROM table WHERE city='London' AND date>'2002-07-19 > 15:39:15+00' ORDER BY date ASC LIMIT 1;"? Close. Try: SELECT city, MAX("date") as last_date F

[SQL] query problem

2002-08-30 Thread Marco Muratori
Hi suppose I have the following situation: citydate -+--- London | 2002-08-08 07:05:16+00 London | 2002-07-30 13:08:22+00 London | 2002-07-30 07:39:15+00 London | 2002-07-29 17:51:47+00 London | 2002-07-29 17:45:49+00 London | 2002-07-29 17:45

Re: [SQL] Query Problem

2000-10-26 Thread Josh Berkus
Michael, > SELECT Data > FROM Table A > WHERE NOT EXISTS ( > SELECT * FROM Table_B, Table_C > WHERE Table_B.GroupID = TableC.GroupID > AND TableC.AccountID = 11 > ) > > I think that the not exists is a bit quicker than the NOT IN. Give it > a whirl. A *lot* faster. Like, 7x as fas

Re: [SQL] Query Problem

2000-10-26 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > Thus, I need to select: > SELECT Data FROM Table A > WHERE CaseID NOT IN ( > SELECT CaseID FROM Table_B, Table_C > WHERE Table_B.GroupID = TableC.GroupID > AND TableC.AccountID = 11) > The problem is, since Table_B and Table_C

Re: [SQL] Query Problem

2000-10-26 Thread Stephan Szabo
What is the explain output for the queries you've tried? Stephan Szabo [EMAIL PROTECTED] On Wed, 25 Oct 2000, Josh Berkus wrote: > > Folks: > > Here's the problem, in abstract: I need to select every record in table > A that does not have a link in table B Join Table C where Table > C.accou

Re: [SQL] Query Problem

2000-10-26 Thread Tomas Berndtsson
Josh Berkus <[EMAIL PROTECTED]> writes: > Folks: > > Here's the problem, in abstract: I need to select every record in table > A that does not have a link in table B Join Table C where Table > C.account = 11 > > The relevant fields: > > Table_A > CaseID > Data > > Table_B > GroupID > CaseID

[SQL] Query Problem

2000-10-26 Thread Josh Berkus
Folks: Here's the problem, in abstract: I need to select every record in table A that does not have a link in table B Join Table C where Table C.account = 11 The relevant fields: Table_A CaseID Data Table_B GroupID CaseID Amount Table_C GroupID AccountID Thus, I need to select: SELECT Dat