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

  • Home
  • SEARCH
  • 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 6707137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:36:12+00:00 2026-05-26T07:36:12+00:00

apologize if there is already answer for that, but as a newbie to I’m

  • 0

apologize if there is already answer for that, but as a newbie to I’m not able to recognize one.

I have a trouble with outputing data from MySQL.
Imagine a table “visits” in MySQL:

1. name------surname------date------visitTime
2. John        White        20111017  13:00
3. John        White        20111017  17:00
4. John        White        20111017  19:00
5. John        White        20111018  07:00
6. Jack        Black        20111017  09:00
7. Jack        Black        20111018  16:00

I would like to have number of visits sumarized by date and printed out on the php page like this

1. name surname 20111017 20111018 ----> other days
2. John White   3        1
3. Jack Black   1        1

the query I’m using so far is

$query = "select name,surname,count(*) as visitCount
          from visits group by name,surname,date";

thanks a lot

  • 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-26T07:36:13+00:00Added an answer on May 26, 2026 at 7:36 am

    I don’t think you want to do it like that. Like KA_lin said this could get very very ugly as you get more and more different visit days.

    A cleaner solution would be to group the data with this query.
    “select name, surname, date, count(date)
    from visits
    group by name, surname, date;
    “

    name surname date visitCount

    Jack Black 20111017 1

    Jack Black 20111018 1

    John White 20111017 3

    John White 20111018 1

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

Sidebar

Related Questions

Apologies if there answer is already out there, but I could not find it.
I apologize for the newb question but have not found a solution online. I
I have a feeling that this probably is not possible using strictly CSS, but,
I apologize if the question already exists... Is there a way to have a
First off, if there is a question/answer that solves my problem already then I
First off, let me apologize if this has been asked already, but I can’t
Please excuse me if there are already answers to this, but I can't quite
There are already quite a number of questions regarding time, but I still couldn't
I am aware that similar questions to this have been asked, but I have
I apologize if this is a duplicate, but I've searched for 3 hours already

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.