Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
robcpettit
Starting Member
11 Posts |
Posted - 2015-03-20 : 15:36:08
|
Hi i have a table with football matches played and there dates. I using ' select [Home Team], [Date] from [all_Years] Where [Home Team]='Arsenal'and [Away Team]='Leeds'order by [Date]'. Works fine, gives me two columns 1 with the home team and the other with the dates. Give me about a list of twenty. What i would like though is ...'Team, date1. date2, date3, etc'. So rather than two columns i would have 1 row, with column for team and then several columns for each date. Is this possible. The idea in the end is to loop through a table of matches, with the past dates in a row when they last played each other.Regards Robert |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-03-20 : 16:07:54
|
Would you be able to post some sample data and desired output using that sample? |
|
|
robcpettit
Starting Member
11 Posts |
Posted - 2015-03-21 : 13:12:45
|
Thankyou for your reply. I have a result table:14/08/1993 Arsenal Coventry 0.00 3.00 A14/08/1993 Aston Villa QPR 4.00 1.00 H14/08/1993 Chelsea Blackburn 1.00 2.00 A14/08/1993 Liverpool Sheffield Weds 2.00 0.00 H14/08/1993 Man City Leeds 1.00 1.00 Detc....Which I wish to search for all matches were say ..Arsenal has played at home to leads and my result looks like:Team DateArsenal 24/8/1993Arsenal 17/12/1994Arsenal 06/04/1996Arsenal 26/10/1996etc...Id like it to look like team col1 col2 col3 col4Arsenal 24/8/1993 17/12/1994 06/04/1996 26/10/1996thankyou |
|
|
|
|
|