group by sql question

hey, i have a table of all the pages viewed by the users of my site. and im trying to summarize their viewing history. Im trying to group together the pages by the saved url. My table is set up like this : 


i need to get out the usersid and distinct pages by the time they were viewed. for example if the data in the table looks like this :

1, page1.aspx, 5/05/09 2.35, 1
2, page2.aspx, 5/05/09 2.34, 1
3, page1.aspx, 5/05/09 2.33, 1

it would return the page, userid and number of views by the 'moment' they were viewed like this :

page1.aspx, 1, 2
page2.aspx, 1, 1

can anyone help? im not amazing at SQL, kinda learning but slowly. John
5/5/2009 1:38:43 AM 29906 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 26
Get it on Google Play
Get it on Apple App Store

SELECT Page, UserID, Count(HistoryID)
FROM table

5/5/2009 2:35:04 AM

Similar Artilces:

Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %> <html> <head> <%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%> <title>Login History</title> </head> <body style="margin:0 0 0 0;padding:0 0 0 0"> ...

SQL Grouping Question
I have a question about how to do a complex sorting of a SELECT query. Say we have the following rows in a table ID GroupID Name 1 1 A 2 2 Z 3 2 B 4 3 C 5 3 X 6 4 Y 7 5 F I want an SQL statement that will return the rows sorted by NAME with the caveat, and this is the complex part, that the groups stay together, sorted by NAME, with their place in the overall table set according to the first member of the group. So, in the above example, the re...

SQL in .NET question
How do i use the LIKE and the wildcards in a search in .NET (using c#) example in straight SQL: SELECT * FROM myDB WHERE LastName LIKE '%Jo%' if i try and use it in .NET like follows: SELECT * FROM myDB WHERE LastName LIKE %@MyVar% I get an error. Try: SELECT * FROM myDB WHERE LastName LIKE @MyVar and then prepend and append '%' characters to the string you are passing in.Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog Wow, I didn't know you could do that. I usually do this which works as well (no prepending of...

I have data similar to the following, that I would like to sum up. code char(2) amount decimal(12,2) code_2 char(2) code_3 char(15) code amount code_2 code_3 01 100.00 NULL 15200.00 01 NULL 03 NULL 02 200.00 04 500.99 02 NULL 04 NULL 03 99.99 NULL 999.99 03 NULL 02 NULL 03 NULL NULL NULL I would like to know if the data above is "group-able" so that I can get a result set like this. code amount co...

Three simple questions about SQL and SQL connections
Hi to all I have these three questions: 1) Is it possible to connection to multiple databases using a single SqlConnection object? If so, gimme please an example of the connection string. The reason why I do this is that I need to pass a cross database SELECT query, but each of the databases has different connection settings (user id, password, ...) so I need to specify that somewhere beforehand (in the conenction string), and then just pass the query using the multiple-connection. Is that possible? 2) How to format integers to string (=char, varchar) in a SELECT query? In ...

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

SQL A and SQL Server
Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL Anywhere, therefore, similar to SQL Server? -- Regards, John Not quite true. SQL Anywhere was created by Watcom. SQLServer was created by Sybase, and Microsoft licensed the technology. So MSSQL and ASE have common roots, not SQLAnywhere. -- Paul Horan[TeamSybase] "John Kingan" <> wrote in message news:40d82aa1$1@forums-1-dub... > Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL > Anywhere, therefore, similar to SQL Ser...

sql insert .net question
Hello, wrote an insert for a C#.Net web app. The insert works fine, except if there are appostrophies (spelling) for example: this isn't a problem this isnt a problem the second one will work the first will not. The info is going into a sql server database as text(16), the same result occurs with char. I believe you'll need to use an escape character "\", so something like this: "this isn\'t a problem" Also, you should try to use stored procedures or at the very least paramater queries. Both of those would solve your problem as well."I would l...

Migrating VS2003 datasource from SQL 2000 to SQL 2005
Is it necessary to convert my VS2003 project to VS2005 before converting the datasource from SQL 2000 to SQL 2005? Or can I just change the datasource without converting the project? Hi delossan, For the first question, the answer is no. Both SQL Server versions can work with Visual Studio 2003 and Visual Studio 2005. For the second question, the answer is yes. Visual Studio 2003 can work with SQL Server 2005.    Sincerely,Benson YuMicrosoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can ...

Group By Team in SQL DataSource?
Is it possible to group by "Team" in the following SQL Datasource? Each row has a numbers in their respective columns and need to be added up and only one row per team is shown showing the total?  SELECT HomeTeam AS Team, 1 AS Pld, CASE WHEN HomeScore > AwayScore THEN 1 ELSE 0 END AS Won, CASE WHEN HomeScore = AwayScore THEN 1 ELSE 0 END AS Draw, CASE WHEN HomeScore < AwayScore THEN 1 ELSE 0 END AS Lost, HomeScore AS Scored, AwayScore AS Against, HomeScore - AwayScore AS Agg, CASE WHEN HomeScor...

SQL Express to SQL ?
I am developing a site using the express edition of all tools (VWD and SQL Express).  I want to use GoDaddy hosting and was wondering if I will be able to effectively put my SQL database and website up on their hosting even though it was developed via Express edition of Microsoft programs?...

Compiled sql CommandText going from DataSource to sql server
HiI need to know what command text goes to sql server in a compiled (parameterless) formatEx :I have a sql query : "Select  * from table where name=@name"name parameter has value = "bill gates"When I read the e.command.commandtext value in sqldatasource.inserting event, it gives the original command (with parameter @name)In datasource.inserting event, how can I get the compiled version of the command  : "Select * from table where name='bill gates'"please help me Why do you need to get the value?  What do you plan to do with it?Brian"Trust in the Lord and do what is good...

I have a problem, my page wants to connect to the sql server, but it has to be the mysql. How can I solve this problem? This is my code: <%@ page explicit="true" language="VB" debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.Odbc" %> <%@ Import Namespace="System.Data.SqlClient" %> <html> <script runat="server"> sub page_load(sender as object, e as eventargs) If Not IsPostBack Then dim connect as sqlconnectio...

Newbie with question about SQL Server and SQL Server Lite
Hi Folks.. Hey, I've got a small app I've got to write that uses currently an Access Database.. The frontend is what I'm working on as the client designed the DB for his client, and I'm desiginging the web site for his client that connects to that DB.. THe hosting company that I use gives me SQL server just for the job, and where the end product is going to be hosted doesn't have SQL server, so I'm wondering if it's ok to use SQL server lite, the newest version for such a thing since it's free, and what restrictions there are? I mean: Is it ok to use for commercial apps? How many connect...

Web resources about - group by sql question -

German question - Wikipedia, the free encyclopedia
"Kleindeutschland" redirects here. For the neighborhood in New York City, see Little Germany, Manhattan . 1820 map of Central Europe showing ...

The Islamic State inspires Eric Posner to question American values
Slate got a lot of hateclicks yesterday for publishing Eric Posner’s argument that, in light of the Islamic State’s efforts to radicalize American ...

Question of the Day: Worst automotive regulatory workaround?
Filed under: Automotive History Jacking up the entire car to meet headlight-height laws, adding sketchy plastic seats to a pickup bed to skirt ...

Excellent Question from an Awful Candidate
Cholly Pierce notes that tribble-topped presidential aspirant Rand Paul actually asked an important question during last night’s GOP debate shit-show: ...

Quick Question
(Don Boudreaux) Tweet If advocates of stricter gun-control regulations are correct that easy access to hand guns necessarily leads to more ...

Chris Matthews Really Doesn’t Like Questions About His Leg
Politics can be so exhausting. Sometimes you just need to have a little fun. And all of us, no matter where we fall on the sociopolitical spectrum, ...

The question remains: Would Bush support a 'Trump for president' ticket?
Donald Trump vowed to forego a third-party run and stick with the GOP during last night’s debate, but we still don't know whether the other candidates ...

Tom Brady Leaves Press Conference After Two Questions About His Friendship With Donald Trump
This morning’s cover of the New York Daily New s features the headline “BRADY HAS NO BALLS” over a picture of New England Patriots quarterback ...

'Star Wars: The Force Awakens' Cast Fields Your Fan Questions
ET got the cast to answer a few of your fan questions at the premiere.

For Designers, Learning To Code Isn't A Yes-No Question
The former CEO of Berg explains why programming is just one way that designers ought to make sense of problems. From 2005 to 2014 (or 483 weeks ...

Resources last updated: 12/17/2015 4:55:27 PM