Re: [GENERAL] Query, view join question.

2005-01-06 Thread Joost Kraaijeveld
Hi both, Thanks for taking the trouble to help me. Based on your responses I realized that a multi key join should do what I wanted and it does. Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: [EMAIL PROTECTED] w

Re: [GENERAL] Query, view join question.

2005-01-06 Thread Ragnar Hafstaư
On Thu, 2005-01-06 at 17:57 +0100, Joost Kraaijeveld wrote: > Hi Tom, > > I could give you access to the database itself if needed. But these are the > actual tables and view. > > I hope I will never make any tpo's again to upset you this way. no-one was upset. the point is just that you are mo

Re: [GENERAL] Query, view join question.

2005-01-06 Thread vhikida
I think there is an echo in here :) It's probably me. I pass for the rest of this thread. > "Joost Kraaijeveld" <[EMAIL PROTECTED]> writes: >> CREATE OR REPLACE VIEW even AS >> SELECT DISTINCT abo_his.klantnummer, >>> abo_his.artikelnummer, abo_his.code_retour, >>> abo_klt.aantal_abonnementen, abo

Re: [GENERAL] Query, view join question.

2005-01-06 Thread vhikida
I think I stated in my previous post but in order to make your view consistent with your original query I think you should do: CREATE OR REPLACE VIEW even AS SELECT DISTINCT abo_his.klantnummer, abo_his.artikelnummer, abo_his.code_retour, abo_klt.aantal_abonnementen, abo_klt.afgewerkt FROM abo

Re: [GENERAL] Query, view join question.

2005-01-06 Thread Tom Lane
"Joost Kraaijeveld" <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE VIEW even AS > SELECT DISTINCT abo_his.klantnummer, >> abo_his.artikelnummer, abo_his.code_retour, >> abo_klt.aantal_abonnementen, abo_klt.afgewerkt > FROM abo_his > JOIN abo_klt ON abo_his.klantnummer = abo_klt.klantnummer > WHERE

Re: [GENERAL] Query, view join question.

2005-01-06 Thread Joost Kraaijeveld
Hi Tom, [EMAIL PROTECTED] schreef: > "Joost Kraaijeveld" <[EMAIL PROTECTED]> writes: >> CREATE OR REPLACE VIEW even AS >> SELECT DISTINCT abo_his.klantnummer, > abo_his.artikelnummer, abo_his.code_retour, > abo_klt.aantal_abonnementen, abo_klt.afgewerkt >>FROM abo_his >>JOIN abo_klt ON ab

Re: [GENERAL] Query, view join question.

2005-01-06 Thread Tom Lane
"Joost Kraaijeveld" <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE VIEW even AS > SELECT DISTINCT abo_his.klantnummer, abo_his.artikelnummer, > abo_his.code_retour, abo_klt.aantal_abonnementen, abo_klt.afgewerkt >FROM abo_his >JOIN abo_klt ON abo_his.klantnummer = abo_klt.klantnummer >

Re: [GENERAL] Query, view join question.

2005-01-06 Thread vhikida
You haven't given the complete information but the following is just a guess. It seems that abonnement is in both tables. The view is stating abo_his.abonnement = 238 I assume that your initial query was WHERE abo_klt.abonnement = 238 and AND abo_klt.afgewerkt > 2 My guess is that you are

Re: [GENERAL] Query, view join question.

2005-01-06 Thread Joost Kraaijeveld
Hi Tom, I could give you access to the database itself if needed. But these are the actual tables and view. I hope I will never make any tpo's again to upset you this way. CREATE TABLE abo_his ( klantnummer int4, abonnement int2, artikelnummer int4, omschrijving char(40), nummer_vd_le

Re: [GENERAL] Query, view join question.

2005-01-06 Thread Tom Lane
"Joost Kraaijeveld" <[EMAIL PROTECTED]> writes: > Hi all, > I have 2 tables: > table1 with the columns objectid, refobjectid, commonvaluecol and value1. > table2 with the columns objectid, refobjectid, commonvaluecol and value2. > A "select * from table2 where commonvaluecol = 123 and value2