Solved

Query to view column

Posted on 2011-02-23
8
286 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
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 4

Assisted Solution

by:rocky_lotus_newbie
rocky_lotus_newbie earned 50 total points
Comment Utility
[BF Charging]

The above paranthesis should work.

Thanks
0
 
LVL 26

Assisted Solution

by:tigin44
tigin44 earned 50 total points
Comment Utility
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:ewangoya
ewangoya earned 150 total points
Comment Utility
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
 

Author Comment

by:algotube
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 32

Accepted Solution

by:
ewangoya earned 150 total points
Comment Utility

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
Comment Utility
Use the "`" symbol to quote:

`BF Charging`

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

Expert Comment

by:jason987
Comment Utility
never mind the above, wrong question I was answering.
0
 

Author Closing Comment

by:algotube
Comment Utility
Oh my God............ Thanks guys......used everything but.......
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now