?
Solved

Query to view column

Posted on 2011-02-23
8
Medium Priority
?
307 Views
Last Modified: 2012-05-11
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
Comment
Question by:algotube
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 4

Assisted Solution

by:rocky_lotus_newbie
rocky_lotus_newbie earned 200 total points
ID: 34965048
[BF Charging]

The above paranthesis should work.

Thanks
0
 
LVL 26

Assisted Solution

by:tigin44
tigin44 earned 200 total points
ID: 34965050
USE Algoma_BF7
GO

SELECT YourColumn, COUNT(*) TotalCount
FROM [BF Charging]
GROUP BY YourColumn
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
GO
0
 
LVL 32

Assisted Solution

by:Ephraim Wangoya
Ephraim Wangoya earned 600 total points
ID: 34965051
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:algotube
ID: 34965055
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
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 600 total points
ID: 34965061

SELECT side, type, COUNT(*) TotalCount
FROM [BF Charging]
GROUP BY side, type
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
0
 
LVL 5

Expert Comment

by:jason987
ID: 34965081
Use the "`" symbol to quote:

`BF Charging`

Also, don't use spaces in column names :)
0
 
LVL 5

Expert Comment

by:jason987
ID: 34965095
never mind the above, wrong question I was answering.
0
 

Author Closing Comment

by:algotube
ID: 34965170
Oh my God............ Thanks guys......used everything but.......
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question