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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:34:41+00:00 2026-06-17T03:34:41+00:00

I have one table,contains a field called Component .The datas are – date component

  • 0

I have one table,contains a field called Component.The datas are –

date             component
----------------------------
2012/12/11       PRP,PU1,P
2012/12/12       PRP 

I want to get result like this-

date          P_QTY
-----------------------
2012/12/11    1

I try a query-

select date,count(date) as P_Qty    
from MyTable 
where component like '%P%'
group by date 

but I get result-

date          P_QTY
-----------------------
2012/12/11    1
2012/12/12    1

There is ambiguous between PRP and P.
So, How can I remove ambiguous between P ,PRP and PU1?
Thanks in advance.

  • 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-17T03:34:42+00:00Added an answer on June 17, 2026 at 3:34 am

    Firstly, it is not the recommended way to store a one-to-many relationship between date and P_QTY.

    To get the desired result, your query should be

    SELECT date,count(date) as P_Qty    
    FROM MyTable
    where 
        (
            component = 'P' OR 
            component LIKE 'P,%' OR 
            component LIKE '%,P,%' OR 
            component LIKE '%,P'
        )
    GROUP BY date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table called FinalForgotten which only contains one field called aname. The field
I have a table called wp-posts with a field post-content. This field contains the
I have a table called Basic , start_time is one field with type :VARCHAR(5),
I have one table which contains events and dates, and another which contains the
Here is my situation: I have one table that contains a list of drugs
I have one database table which contains 8 columns. One of the columns is
I have two tables. One table contains words. Other table contains points. table words:
What I have is two tables inside of a mysql database. One table contains
I currently have a user's table which contains a one-to-one relationship for Youtube OAuth
I have a table in Oracle where one of the column contains UserIds which

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.