Solved

Query to view column

Posted on 2011-02-23
8
294 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 50 total points
ID: 34965048
[BF Charging]

The above paranthesis should work.

Thanks
0
 
LVL 26

Assisted Solution

by:tigin44
tigin44 earned 50 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 150 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
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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…
Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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