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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:56:14+00:00 2026-05-11T03:56:14+00:00

I have a legacy MySQL table called lnk_lists_addresses with columns list_id and address_id .

  • 0

I have a legacy MySQL table called lnk_lists_addresses with columns list_id and address_id. I’d like to write a query that reports all the cases where the same list_id–address_id combination appears more than once in the table with a count.

I tried this…

SELECT count(*), list_id, address_id FROM lnk_lists_addresses GROUP BY list_id, address_id ORDER BY count(*) DESC LIMIT 20 

It works, sort of, because there are fewer than 20 duplicates. But how would I return only the counts greater than 1?

I tried adding ‘WHERE count(*) > 1‘ before and after GROUP BY but got errors saying the statement was invalid.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T03:56:14+00:00Added an answer on May 11, 2026 at 3:56 am
    SELECT count(*), list_id, address_id FROM lnk_lists_addresses GROUP BY list_id, address_id HAVING count(*)>1 ORDER BY count(*) DESC 

    To combine mine and Todd.Run’s answers for a more ‘complete’ answer. You want to use the HAVING clause:

    http://dev.mysql.com/doc/refman/5.1/en/select.html

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

Sidebar

Related Questions

Let's say I have a legacy MySQL table called server with fields serverid:integer and
In a legacy MySQL database I have a table with a field that is
I have a legacy PHP/MySQL app that calls mysql_connect(). Tons of existing downstream code
I have a Django1.1 project that works with a legacy MySQL db. I'm trying
I have a mysql legacy table which contains an client identifier and a list
I have a MySQL server with many databases that have a similar table structure.
I have a legacy application that I would like to move over to Symfony2.
I have a legacy table with (horrible) column names like LYEAR#2, LYEAR#3 ... LYEAR#9
I have a legacy mysql database and there's this table which has a few
This is on MySQL 5.0. I have a legacy program that had a weird

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.