![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
i have a table transactions. which have 2 fields id and loyalty_id. here the Id is primary key. my table like this. ID loyalty_id 1 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 Here the loyalty_id field have repeated values.i need the repeated values count. I tried this and i got the repeated values. But i need the count. That means. when i run this query SELECT loyalty_id FROM transactions GROUP BY loyalty_id HAVING COUNT(*)>1; From this i got loyalty_id 1 2 3 4 But i need the count, here the count(loyalty_id) is 4. how to get that with the above query..? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
i have a table transactions. which have 2 fields id and loyalty_id. here the Id is primary key. my table like this. ID loyalty_id 1 1 2 1 3 1 4 2 5 2 6 3 7 3 8 4 9 4 10 5 Here the loyalty_id field have repeated values.i need the repeated values count. I tried this and i got the repeated values. But i need the count. That means. when i run this query SELECT loyalty_id FROM transactions GROUP BY loyalty_id HAVING COUNT(*)>1; From this i got loyalty_id 1 2 3 4 But i need the count, here the count(loyalty_id) is 4. how to get that with the above query..? |
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Thank you for the reply.. i think, u didn't get my question.. SELECT loyalty_id FROM authors GROUP BY loyalty_id HAVING COUNT(*)>1; when i run this above query i got the output like loyalty_id 1 2 4 this output means, the repeated values having count>1. the output is correct. but i don't need to display like this. i need to display, how many repeated values, here 3 values(1,2,4). i need this 3. how to display that? |
#8
| |||
| |||
|
#9
| |||
| |||
|
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |