Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6687735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:19:25+00:00 2026-05-26T05:19:25+00:00

I have a table with fields 1: Visit Place 2: Visit Date I have

  • 0

I have a table with fields

1: Visit Place
2: Visit Date

I have to calculate the visit No. of any visit in specific date range.Visit range will be calculate on month basis means how many times a place is visited but data should be shown only of required date.

My query is as:

SELECT visit_date,
       VisitPlaceId,
       [Visit Frequency]
FROM   (SELECT visit_date,
               VisitPlaceId,
               'Visit-' + CONVERT(VARCHAR, ROW_NUMBER() OVER ( PARTITION BY
                          VisitPlaceId ORDER
                          BY
                          VisitPlaceId))AS [Visit Frequency]
        FROM   tbl_Visits
        WHERE  visit_date >= '01/Sep/2011'
               AND visit_date <= '30/Sep/2011'
        GROUP  BY visit_date,
                  VisitPlaceId) tbl
WHERE  visit_date >= '01/Sep/2011'
       AND visit_date <= '05/Sep/2011'  

Can it be modified to result faster.

Looking for your kind and precious solutions.

Thanks.
Supriya

Ya,it is like

 CREATE TABLE dbo.tbl_Visits
    (
    Report_ID       INT IDENTITY NOT NULL,
    User_ID         INT NOT NULL,
    City_ID         INT NOT NULL,
    VisitPlaceId        INT NOT NULL,
    CategoryId      INT NOT NULL,
    Area            VARCHAR (512) NULL,
    Remarks         VARCHAR (264) NULL,
    visit_date      SMALLDATETIME NULL,
    POSM_Used       VARCHAR (250) NULL,
    PosmBanner      INT NULL,
    PosmBooklet     INT NULL,
    PosmBunting     INT NULL,
    PosmDangler     INT NULL,
    PosmDummyBox    INT NULL,
    PosmTearPad     INT NULL,
    PosmPoster      INT NULL,
    PosmShelfStrip  INT NULL,
    PosmStandee     INT NULL,
    PosmTableTop    INT NULL,
    PosmWobbler     INT NULL,
    PosmLeafLet     INT NULL,
    PosmBrochure    INT NULL,
    Exe_Remarks     VARCHAR (200) NULL,
    ApprovalRemarks VARCHAR (50) NULL,
    ApprovalStatus  VARCHAR (10) NULL,
    ApprovalDate    SMALLDATETIME NULL,
    ApprovedBy      INT NULL
    )
GO

And no index I have created yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:19:25+00:00Added an answer on May 26, 2026 at 5:19 am

    You could add a non clustered index as below

    CREATE NONCLUSTERED INDEX ix_name On tbl_Visits(visit_date,VisitPlaceId)  
    

    This covers the query and allows the visit_date range of interest to be seeked to directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with some fields that the value will be 1 0. This
I have a table with 3 fields: color, fruit, date. I can pick 1
i have simple table with two fields: ID and Date how can i do
I will have 2 fields in my table, NEXTTIME and ENDTIME, the table name
I have table with fields ID and date , I need to assign newest
I have a table with three fields, FirstName, LastName and Email. Here's some dummy
I have a table with 3 fields: ID (not unique, not primary key) timestamp
I have a table with three fields, User , City and Country , where
I have a table T with fields id, parentid , name. i make relationship
I have a table of 2 fields. Word and timestamp. Then i have this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.