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.
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