Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Query to view column

Posted on 2011-02-23
8
Medium Priority
?
312 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 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

972 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