Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SQL Query
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sr_aneesh
Starting Member

17 Posts

Posted - 12/17/2005 :  04:35:37  Show Profile  Reply with Quote
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

activecrypt
Posting Yak Master

Germany
165 Posts

Posted - 12/17/2005 :  05:42:34  Show Profile  Visit activecrypt's Homepage  Send activecrypt a Yahoo! Message  Reply with Quote
Hi,
add 3 days (as you said its 3 days) in visit1 then visit2 and as on , use dateadd function then

:-)
Regards

Andy Davis
Activecrypt Team
--------------------------------------------
SQL Server Encryption Software
http://www.activecrypt.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000