• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

Query to view column

Hello Experts

I have a table called BF Charging.  I am trying to find the count of all duplicate records in this table.

USE Algoma_BF7
GO

SELECT YourColumn, COUNT(*) TotalCount
FROM BF Charging
GROUP BY YourColumn
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
GO

I am receiving this error message
Msg 208, Level 16, State 1, Line 2
Invalid object name 'BF'.

Getting this because of the space in BF Charging. Tried using different parentheses but did not work.

Thanks

0
algotube
Asked:
algotube
  • 2
  • 2
  • 2
  • +2
4 Solutions
 
rocky_lotus_newbieCommented:
[BF Charging]

The above paranthesis should work.

Thanks
0
 
tigin44Commented:
USE Algoma_BF7
GO

SELECT YourColumn, COUNT(*) TotalCount
FROM [BF Charging]
GROUP BY YourColumn
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
GO
0
 
Ephraim WangoyaCommented:
if BF Charging is the table name, put it within brackets


SELECT YourColumn, COUNT(*) TotalCount
FROM [BF Charging]
GROUP BY YourColumn
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
algotubeAuthor Commented:
Sorry this is the query:

USE Algoma_BF7
GO

SELECT side, type, COUNT(*) TotalCount
FROM BF Charging
GROUP BY YourColumn
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
GO

0
 
Ephraim WangoyaCommented:

SELECT side, type, COUNT(*) TotalCount
FROM [BF Charging]
GROUP BY side, type
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
0
 
jason987Commented:
Use the "`" symbol to quote:

`BF Charging`

Also, don't use spaces in column names :)
0
 
jason987Commented:
never mind the above, wrong question I was answering.
0
 
algotubeAuthor Commented:
Oh my God............ Thanks guys......used everything but.......
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now