redundant data
-
I'm trying to count data in a table. I was able to do it, however, when a data exists more than once, it shows it again and counts it again
for example:
column_name Count string 2 another string 1 same string 2
This is my query:
SELECT table_1, (SELECT COUNT(column_1) FROM Records as t1 WHERE t1.column_1 = table_1.column_1) AS Count FROM table_1
Can anyone suggest an approach that would solve such redundancy? Thanks! -
I'm trying to count data in a table. I was able to do it, however, when a data exists more than once, it shows it again and counts it again
for example:
column_name Count string 2 another string 1 same string 2
This is my query:
SELECT table_1, (SELECT COUNT(column_1) FROM Records as t1 WHERE t1.column_1 = table_1.column_1) AS Count FROM table_1
Can anyone suggest an approach that would solve such redundancy? Thanks! -
try this
select distinct c1,count(c1) from table1 group by c1
Bob Ashfield Consultants Ltd
-
I'm trying to count data in a table. I was able to do it, however, when a data exists more than once, it shows it again and counts it again
for example:
column_name Count string 2 another string 1 same string 2
This is my query:
SELECT table_1, (SELECT COUNT(column_1) FROM Records as t1 WHERE t1.column_1 = table_1.column_1) AS Count FROM table_1
Can anyone suggest an approach that would solve such redundancy? Thanks!Do use the distinct keyword as suggested by Mr. Ashfield :)
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham