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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:10:19+00:00 2026-05-16T00:10:19+00:00

I am using Oracle SQL and I want to group some different rows that

  • 0

I am using Oracle SQL and I want to group some different rows that ‘like’ function results. To elaborate with an example:


Let’s assume I have a table MESA with one of the columns is a huge string. And I am counting the number of rows matching particular patterns:

SELECT m.str, count(*)
FROM MESA m
WHERE m.str LIKE '%FRUIT%'
AND (m.str LIKE '%APPLE%' OR m.str LIKE '%ORANGE%')

So let’s assume the result of this query is:

FRUIT..afsafafasfa…RED_APPLE 20

FRUIT..afsafafasfa…YELLOW_APPLE 12

FRUIT..afsafafasfa…GREEN_APPLE 3

FRUIT..afsafafasfa…PURPLE_ORANGE 4

FRUIT..afsafafasfa…RED_ORANGE 45

But I want my results to be:

APPLE 35

ORANGE 49


Is this possible to do? If so, how so? : )

Comments and code snippets are much appreciated.

PS: Of course the query and the results are more complicated than the above example. I just wrote it like for the sake of simplicity to explain.

Cheers..

  • 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-16T00:10:20+00:00Added an answer on May 16, 2026 at 12:10 am

    Sure:

    WITH Fruits AS (
        SELECT 
            CASE 
               WHEN m.str LIKE '%APPLE%' THEN 'Apple'
               WHEN m.str LIKE '%ORANGE%' THEN 'Orange' 
            END AS FruitType           
        FROM MESA m
        WHERE m.str LIKE '%FRUIT%')
    SELECT FruitType, COUNT(*) 
    FROM Fruits
    WHERE FruitType IN ('Apple', 'Orange')
    GROUP BY FruitType;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 515k
  • Answers 515k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer <?php //other code here..... if ($query) { $message = "Success:… May 16, 2026 at 6:39 pm
  • Editorial Team
    Editorial Team added an answer var tgtCol = $('td[aria-describedby=tblGrid_Subject]'); var tgtHdr = $('#tblGrid_Subject'); $(tgtHdr).add(tgtCol).attr('colSpan', '3');… May 16, 2026 at 6:39 pm
  • Editorial Team
    Editorial Team added an answer You have to define @Retention for your annotation: @Retention(RetentionPolicy.RUNTIME) public… May 16, 2026 at 6:39 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am using Oracle Sql Developer I have a huge script that creates tables,
Coming from SQL Server, I am learning some Oracle syntax. This is my table
In addition to How to create a dump with Oracle PL/SQL Developer? Is that
In MS SQL Server if I want to check the results from a Stored
I have rows in an Oracle database table which should be unique for a
Is it possible to see the DML (SQL Statement) that is being run that
I want to substitute a variable in oracle . The var is coming in
I have created a website with asp.net and uses oracle connectivity with pl/sql developer.i
I've just made the switch from MS sql server to Oracle. The query tool
I'm SELECTing some aggregate data and grouping on the date and a particular field.

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.