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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:00:14+00:00 2026-06-06T14:00:14+00:00

I have a query that displays columns from multiple tables in a test dbase.

  • 0

I have a query that displays columns from multiple tables in a test dbase. The output are hotels from all over the world with their corresponding information. My search criteria is simple; no blank fields and I want their phone numbers that don’t start with a + sign.

It works but it displays all entries (like it should) BUT is it possible to only display the total number of items found, for example, per country? For example it displays 5000 lines in China, 3458 lines in Italy, 2050 lines in Canada etc etc.. Is it possible to just display the total amounts found?
5000 : China
3458 : Italy
2050 : Canada
etc
etc

I’ve tried COUNT and HAVING but it hasn’t worked for me so far. I also looked up a few topic here but still no success. This is my query:

SELECT 
hotel.id HotelID, 
hotel.name Hotel_Name, 
hotel.tel_area Area_Number,
hotel.tel Phone_Number,
city.name City,
region.name Region,
country.name Country,
country.id CountryID,
country.continent Continent,
hotel.web Website

FROM mydata.hotel      as hotel
JOIN mydata.city       as city     ON hotel.city = city.id
JOIN mydata.region     as region   ON region.id = city.region
JOIN mydata.country    as country  ON country.id = region.country

where hotel.tel not like ''
and accos.tel not like '+%'

order by country.name

Anybody suggestions?

  • 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-06T14:00:16+00:00Added an answer on June 6, 2026 at 2:00 pm
    SELECT 
    country.name Country,
    COUNT(*)
    FROM mydata.hotel      as hotel
    JOIN mydata.city       as city     ON hotel.city = city.id
    JOIN mydata.region     as region   ON region.id = city.region
    JOIN mydata.country    as country  ON country.id = region.country
    
    where hotel.tel not like ''
    and accos.tel not like '+%'
    GROUP BY Country
    /*an ORDER BY is not really needed in this case, in MySQL GROUP BY contains an implicit ORDER BY*/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that basically combines tables of actions and selects from them
I have a query in my android app that pulls all image paths from
I have a problem, i have a query that just simply displays the user
I have a query that successfully grabs the unique products from my products table
I have a query that looks like this SELECT * from myTable WHERE Date
In my application I have a generic query that applies to multiple users. There
I have a table that displays data from a MySQL table. I have an
I have a PHP page that displays the results of a mysql query. each
I have a simple query: $query = new WP_Query('showposts=5'); that will obviously display 5
I am using in C# MYsql .I have query that works if I run

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.