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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:56:42+00:00 2026-06-05T13:56:42+00:00

I have a table like this: column_a column_b foo 1 bar 1 bar 2

  • 0

I have a table like this:

column_a  column_b
  foo        1
  bar        1
  bar        2
  baz        4

I’d like to have following result, containig all rows, that have a unique field value in column_b:

  bar        2
  baz        4

foo(0) and bar(1) both have the column_b value ‘1’, so the ‘1’ is not unique.
Is there a MySQL-Expression that filters all rows that have a unique column_b?

Maybe something like that:

select * from table where isunique(column_b)

In Addition: I do not need something like DISTINCT!

edit (solved):

Thanks to YaK and jcho360, this one is the solution:

select column_a, column_b from table group by column_b having count(column_b) = 1

OR

select column_a, column_b, COUNT(1) AS total from table group by column_b having total = 1

(thx to andrewtweber)

  • 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-05T13:56:45+00:00Added an answer on June 5, 2026 at 1:56 pm

    Using the count function will provide a selection where the value in column_b only occurs once. Try this:

    select * from table group by (column_b) having count(column_b) = 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table say something like this: column_a column_b foo 1 bar 1
I have a table like this: How do I count rows that have identical
Suppose you have a DB table like this: Table t .... column_a integer column_b
I have a mySQL table that has a column like this: ID ----- 0352
I have a table like this: create table foo ( a number, b number
I have a table in Excel that looks like this: Column A Column B
I have a table something like EMPLOYEE_ID DTL_ID COLUMN_A COLUMN_B --------------------------- JOHN 0 1
I am very inexperienced with SQL. I have a table that looks like this:
I have a XML column in a table that looks like this: <word A=al
Assume I have a table like this: column A(int) column B(int) 1 2 2

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.