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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:13:03+00:00 2026-05-29T11:13:03+00:00

I have also a question regarding distinct and/or group by. My table as follow:

  • 0

I have also a question regarding distinct and/or group by. My table as follow:

|   art   |   ean             |   obs   |   vke   |
---------------------------------------------------
|  type    |  1234567890123   |    1    |   100   |
|  type    |  1234567890123   |    0    |   50    |
|  type    |  1234567890123   |    0    |   60    |
|  type    |  1234567890123   |    0    |   70    |

I need the query to select always the row with obs = 1 and only the cheapest of the others with obs = 0. All other equal EAN should not be listed at all. Is this possible ?

So the result should be:

|  type    |  1234567890123   |    1    |   100   |
|  type    |  1234567890123   |    0    |   50    |
  • 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-29T11:13:04+00:00Added an answer on May 29, 2026 at 11:13 am
    select art, ean, obs, vke 
    from table_name
    where obs = 1
    union all
    select art, ean, obs, min(vke) as vke
    from table_name
    where obs = 0
    group by art, ean, obs
    

    I’d union two results first one are all rows with obs aquals 1 and the second all rows grouped by art, ean, obs with obs equals 0 and min value of vke.

    Read more about union and group by.

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

Sidebar

Related Questions

I have question regarding RESTful resources similar to this other question . We're also
I have a question regarding type conversion in Java as follows: suppose I have
I have downloaded sample code from Apple Center.I also have gone through following question:
I have a question regarding how to best accomplish something in WPF MVVM. I
I have a question regarding syntax that I've been coming across in JavaScript. What
I have a question regarding the columns LOW_VALUE and HIGH_VALUE in the view USER_TAB_COLUMNS
I have a question regarding nested doseq loops. In the start function, once I
i have a question regarding some complex data-binding. I want to be able to
I have a question regarding a rather advanced DataModel which I would like to
I have a question regarding inheritance in Java. If I have this base class

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.