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.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Query help please

Author  Topic 

Rick_Boston
Starting Member

5 Posts

Posted - 2009-03-09 : 22:02:56
Query help

At present i have a table as follows

ip_address page_requested
192.168.1.1 www.com
192.168.1.1 www.2.com
192.168.1.1 www.3.com
193.131.2.1 www.go.com
193.131.2.1 www.go2.com
193.131.2.1 www.go3.com
193.131.2.1 www.go4.com

I am looking for a query to help me re organise/create a new table as show below

Ip_address page_requested page_requested2 page_requested3
192.168.1.1 www.com www.2.com www.3.com
193.131.2.1 www.go.com www.go2.com www.go3.com ...cont

I also have hundreds more ip’s that have visited various amounts of pages. So the new rows will need to auto fill depending on how many pages the ip has visited

Thanks
Rick

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-03-09 : 22:16:05
Look at PIVOT.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-10 : 04:25:56
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/08/27/dynamic-pivot-in-sql-server-2005.aspx
Go to Top of Page

Rick_Boston
Starting Member

5 Posts

Posted - 2009-03-12 : 18:52:19
That is perfect thanks mate
#rick
Go to Top of Page
   

- Advertisement -