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 8246881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:39:22+00:00 2026-06-07T22:39:22+00:00

My sample table data is: and my sql query is: SELECT Distinct CASE CHARINDEX(

  • 0

My sample table data is:

Table Data

and my sql query is:

SELECT
Distinct
   CASE CHARINDEX( '?', SessionURL)
       WHEN 0 THEN SessionURL
       ELSE LEFT(SessionURL, CHARINDEX( '?', SessionURL) - 1) END AS VisitPage, count(*) as [VisitTime] 
FROM SessionTracker  
 group by SessionURL
order by [VisitTime] desc

Query run sucessfully and returns a value with out query string.Means result from above data is:

result
But I want a result only in a format:

Default
Modules

Is it possible this type of filter in sql query.If yes suggest a way.Thanks.

  • 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-06-07T22:39:23+00:00Added an answer on June 7, 2026 at 10:39 pm

    Yes. The same way as you filter the querystring, filter on the / and the . You need the SUBSTRING function. To find the last occurence of the /, use the REVERSE function.

    ie.

    select pagename, COUNT(*)
    from
    (
        select 
            reverse(case CHARINDEX('/', withoutsuf) when 0 then withoutsuf 
            else LEFT(withoutsuf,CHARINDEX('/', withoutsuf)-1 ) end) as pagename
        from
        (
            select 
                substring(withoutq, CHARINDEX('.', withoutq)+1, LEN(withoutq)) withoutsuf
            from
            (
                select
                    REVERSE(
                        CASE CHARINDEX( '?', SessionURL) 
                        WHEN 0 THEN SessionURL 
                        ELSE LEFT(SessionURL, CHARINDEX( '?', SessionURL) - 1) END) as withoutq
                from SessionTracker
            ) v
        ) v
    ) v
    group by pagename
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a sample query in sql server to parse data from xml
In postgresql, I need to insert data to, say table B from sql query
For my question lets consider the following sample table data: ProductID    ProductName    Price   Category 1                Apple                 5.00       Fruits
Data: Here is sample table(TableA) data ID StartTime EndTime 1 2012-03-22 06:00:00.000 2012-03-22 06:30:00.000
I have a sample data table(id, name, date_create) table(1, 'Iphone 4S', '2012-06-18 17:19:05') //
I have table of data that is sorted as follows: Item | Sample |
Here is sample data <table class=sparql border=1> <tr> <th>abstract</th></tr> <tr> <td> Cologne is Germany&#39;s
Here is the sample data for test table I have [childId] [parentId] [present] 1
Could you help to give me the sample for display data in table using
I have a SQL script, which spools data to a file. Sample Existing SQL

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.