Unix Technical Forum

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

This is a discussion on SQL Statement to generate customer list whose last payment date is jan 04 within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi all, I have a problem trying to generate the u/m list of customer. I am trying to generate ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 03:24 AM
The Blob
 
Posts: n/a
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 03:24 AM
Kevin Frey
 
Posts: n/a
Default Re: SQL Statement to generate customer list whose last payment date is jan 04

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:48 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com