Returning Data

Results 1 to 2 of 2

Thread: Returning Data

  1. #1
    Join Date
    Dec 1969

    Default Returning Data

    I was hoping that someone could help me with a SQL problem that has been troubling me for months.<BR><BR>Lets say i have a table with called hits.* The table has the following fields.<BR><BR>Creationdate,* IP<BR><BR><BR><BR>The desired output i wish to have is hits per day.<BR><BR>So <BR>Dec1* 15 hits from 12 unique IPs<BR>Dec2* 17 hits from 17 unique IPs<BR><BR>etc.** Is there anyway this can be done on SQL Server in one shot ?

  2. #2
    Join Date
    Dec 1969

    Default RE: Returning Data

    Nope, not with your table structure. You can accomplish what you are wanting to do in one of two ways. Have a table that has a row inserted for every hit, which would have the following structure:<BR><BR>HitDate<BR>IP<BR><BR>Where HitDate was assigned the value of getdate() each time a new row was added (which would occur every "hit")<BR><BR>Or, you could have a table that stored the # of hits for each day.<BR><BR>Day<BR>Hits<BR>IP<BR><BR>You would have to use some programmatic logic to determine whether to add a new row or update an existing row when using this technique, though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts