473,505 Members | 14,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Statement to generate customer list whose last payment date is jan 04

Hi all,
I have a problem trying to generate the u/m list of customer.
I am trying to generate a list of customer whoes last commence date is
jan 04 to current.

It is part of a billing system which the customer come in and pay for
their season parking in carpark. They can pay for various period
shortest being 1 week.

so i will have customer paying for 1 week, 1 month, 2 months or even 1
year. Everytime a customer come in to pay, a new line at the incvoice
will be generated.

My DB structure is as followed

Customer Table
-Cust_Acc_No ----> (Primary Key)
-Customer Name
-Customer Address

Invoice
Cust_acc_no-- Link to customer table
Invoice_no -- primary key

invoice details
invoice_no -- link to invoice table
commence_date
expiry_date
amount_paid
if i do a

select * from customer a, invoice b, invoice_details c
where a.cust_acc_no=b.cust_acc_no and
b.invoice_no=c.invoice_no and
c.commence_date>1/1/04

it doesnt works as it will show

john, 1/1/04 - 31/1/04
john, 1/2/04 - 29/1/04
i do not want repetitive customer number just the latest commence
date.
can anyone help?

thanks
Jul 20 '05 #1
1 2902
Why did you start a separate thread from the one entitled "SQL
Statement for generating expired customer" ?

A number of people (myself included) have already provided help there
for you.
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2424
by: The Blob | last post by:
Hi all, I need sone help on generating a SQL statement i had 3 tables now Customer >> Name >> Acct No >> Address
4
1988
by: mcca68 | last post by:
hi i'm trying to insert new and updated fields into my onlinereg2 table from datatransfer table (imported weekly into access), though i am running into problems. when i click run, i receive an...
1
4986
by: jburris | last post by:
I am completely new to VBA. I am trying to update a yes/no box in a subform based on a value that I call from the main form into the subform. Below is the if /then statement i am using: If...
37
3245
by: Steven Bethard | last post by:
The PEP below should be mostly self explanatory. I'll try to keep the most updated versions available at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
18
2682
by: Steven Bethard | last post by:
I've updated the PEP based on a number of comments on comp.lang.python. The most updated versions are still at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
6
2154
by: Heiko Wundram | last post by:
Hi all! The following PEP tries to make the case for a slight unification of for statement and list comprehension syntax. Comments appreciated, including on the sample implementation. ===...
6
2127
by: Twobridge | last post by:
I hope someone can help me out with my problem. I have found a sql statement that basically pulls all bills filed within a certain time period and the payments made on those bills with in the...
3
1760
by: rlbSQL | last post by:
I am trying to find the last payment date made to a vendor in a table. This table has many vendors I will need to have a line for each vendor and what thier last payment date is. I assume it...
4
2095
by: kjflash | last post by:
Hi, Let's say I have a table containing payment information: CustID, PaymentDate, PaymentAmount. Here is some sample data: CustID Date Amount 01 ...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.