Free2Code
 
Time: 2008-11-21, 10:10pm
SQl Query
Subject: SQl Query  ·  Posted: 2005-12-16, 09:43pm
Rank: ? (1)
Member #: 26113
I have two Tables Customer and Visit
I want to display the next 4 visit Dates Against Each Customer

Customer Table

ID Customer1

1 Customer1
2 Customer2
3 Customer3
4 Customer4
5 Customer5
6 Customer6



Visit Table

CustomerId VisitDate
3 12/15/2005
4 12/10/2005
2 12/22/2005
3 12/22/2005
1 12/22/2005
3 12/29/2005
2 12/25/2005




Which should Display as (Following are dummy data)


Customer Name Visit1 Visit2 Visit3 Visit4
Customer 1 12/15/2005 12/18/2005 12/21/2005 12/24/2005
Customer 2 12/13/2005 12/16/2005 12/25/2005
Customer 3 12/14/2005 12/20/2005
Customer 4 12/16/2005 12/19/2005 12/26/2005
Customer 5 12/19/2005 12/22/2005
Customer 6 12/6/2005 12/18/2005
Customer 7 12/25/2005 12/26/2005 12/28/2005 12/29/2005



Thanx in Advance

 
  Reply to this ·  Post link ·  Top
Subject: Re: SQl Query  ·  Posted: 2005-12-20, 05:35am
Rank: ? (4821)
Member #: 3416
i think you'd have to do one query to get each customer, then another query per customer to get the next 4 dates.

my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
 
  Reply to this ·  Post link ·  Top

Pages: 1

Please login or register to post a reply.

icons