


How to count the number of records when using GROUP BY COUNT DISTINCT
For example, in a table like this, I want to count the number of records with different emails and passwords. Copy the code. The code is as follows: unsigned NOT NULL auto_increment,
`email` char(100) NOT NULL,
`passwords` char(64) NOT NULL, PRIMARY KEY (`email_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6;
INSERT INTO `test_users` (`email_id`, `email`, `passwords`) VALUES(1, 'jims@gmail.com', '1e48c4420b7073bc11916c6c1de226bb'),
(2, 'jims@yahoo.com.cn' , '5294cef9f1bf1858ce9d7fdb62240546′),
(3, 'default@gmail.com', '5294cef9f1bf1858ce9d7fdb62240546′),
(4, 'jims@gmail.com', ”),
(5, 'jims@gmail.com ', ”);
Usually our approach is like this
Copy the code
The code is as follows:
SELECT COUNT(*) FROM test_users WHERE 1 = 1 GROUP BY email,passwords
What is the result of this? Copy the code
The code is as follows:
1
2
1 1 Obviously this is not the result I want. What is counted is the number of records with the same email and passwords Sum, the following is enough
Copy the code
The code is as follows:
Of course, you can also use mysql_num_rows in php Get the number of records, but this is not efficient. You can refer to this articlemysql_num_rows VS COUNT efficiency problem analysis The above has introduced how to count the number of records COUNT DISTINCT when using GROUP BY, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





No matter how many instant messaging apps have come and gone, email always has a completely different feel to it. Mailing is truly synonymous with Gmail. Not to mention a professional front desk, Gmail is unavoidable, just unavoidable! Since Gmail is used so frequently, no matter what, you have to know how to make your Gmail experience the smoothest and most efficient. You will most likely need to add a lot of web links in the body of your email, and it will definitely look unwieldy if you have so many links. But links are definitely necessary, even if long links will definitely make your email look ugly. So is there a way out? What about hyperlinks? How do you hide a link in text or an image? Sound cool? Oh yes, Gmail is

To learn more about open source, please visit: 51CTO Hongmeng Developer Community https://ost.51cto.com Running environment DAYU200:4.0.10.16SDK: 4.0.10.15IDE: 4.0.600 1. To create an application, click File- >newFile->CreateProgect. Select template: [OpenHarmony] EmptyAbility: Fill in the project name, shici, application package name com.nut.shici, and application storage location XXX (no Chinese, special characters, or spaces). CompileSDK10, Model: Stage. Device

How to Remove Boomerang from Gmail Find below our step-by-step guide to remove Boomerang from your Gmail account on your PC or mobile phone. To remove Boomerang from Gmail on PC, open Google Chrome browser on your computer. In Google Chrome, click the three-dot icon in the upper right corner of the screen. Select More Tools from the drop-down menu. Click Extensions from the next drop-down menu. On the Extensions screen, look for

The journey of an email is: MUA: MailUserAgent - Mail User Agent. (i.e. email software similar to Outlook) MTA: MailTransferAgent - Mail transfer agent, which is those email service providers, such as NetEase, Sina, etc. MDA: MailDeliveryAgent - Mail delivery agent. A server of the Email service provider sender->MUA->MTA->MTA->if

Have you noticed that when you try to delete a message in Gmail on iOS, you only see the archive option? Read on to learn how to delete Gmail on iPhone without archiving it in the Mail app. The setting to change the default option for archiving Gmail emails using the Mail app on iPhone and iPad is completely hidden in Settings, but it can be changed quickly once you know where to go. Keep in mind that this tutorial is for people using Gmail through the Apple Mail app on iPhone and iPad. Another option is to use the Gmail app on your iPhone/iPad. you even

Gmail is the most popular web-based email server from Google, and it comes with many powerful features that are helpful when browsing, editing, and sending emails. One such feature is the autocomplete list, which allows users to view a list of email addresses saved as contacts before finishing entering the full address. This feature is really useful but sometimes it may not be a good approach as there may be some email addresses that are no longer valid or may have been deleted by the user. For example, someone who leaves an organization no longer has access to a company email address. But there is a way to remove those email addresses that are highlighted in Gmail's autocomplete list. If you also want to remove emails from Gmail autocomplete list

Google is expanding its Gmail app at Android with an AI-powered Q&A function which was already available in the web version of Gmail and is powered by Google's Gemini AI assistant. Users can now search their inbox more efficiently by asking speci

On your iPhone, are you trying to find old emails archived in Gmail but are unable to do so? You are not alone, so don't worry. Many people face difficulties finding and recovering old emails on their mobile devices. In this blog post, we will walk you through the process of finding and recovering archived emails in Gmail on iPhone. We'll also provide tips and tricks to help you keep your inbox organized and find important emails more easily in the future. So whether you're trying to retrieve important business emails or sentimental messages from loved ones, you'll learn how to easily access and recover archived emails. Archive your emails in Gmail Step 1: On iP
