Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f6GGdLa03843 for ; Mon, 16 Jul 2001 12:39:21 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6EMUra32308; Sat, 14 Jul 2001 18:30:53 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f6EMIl227046; Sat, 14 Jul 2001 18:18:47 -0400 (EDT) (envelope-from news) From: "Henry" X-Newsgroups: comp.database.ms-sqlserver, comp.databases.ms-sqlserver, comp.databases.postgresql.questions, comp.databases.postgresql.sql, microsoft.public.sqlserver.programming Subject: Help with SQL statement - Thanks Lines: 31 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: X-Complaints-To: abuse@usenetserver.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly. Organization: BELLSOUTH.net & WebUseNet Corp - "ReInventing the UseNet" Date: Sat, 14 Jul 2001 15:16:01 -0400 To: pgsql-general@postgresql.org.pgsql-sql@postgresql.org X-Archive-Number: 200107/202 X-Sequence-Number: 3997 There is a table called "Payments" which records every payment that a company has received: CustomerNo Date Amount ---------------------------------------- 3214 2/12 30 3214 4/10 50 9943 4/18 40 9943 5/10 30 9943 2/13 70 1121 5/23 10 1121 4/20 40 1121 3/12 30 (more data...) I want to be able to pull out the last payment made by everyone in a query: CustomerNo Date Amount --------------------------------------- 3214 4/10 50 9943 5/10 30 1121 5/23 10 (other users...) How should I write the SQL statement? Please email to me at henry_lu@hotmail.com. Thank you very much. Henry