Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help with a View

Author  Topic 

19Jon
Starting Member

1 Post

Posted - 2013-09-12 : 14:21:00
Hi there I am very new to SQL and would appreciate any help. I have created a view using unique names and corresponding IDs from a previously built table. I built the view by right clicking on view and selecting create view instead of using build new query. My question is... what does "select queries that count the number of records will produce unique lists" mean? I was asked to make sure of this and I cannot figure what is meant by it. Can anyone help?
Thank you.

example of of view.

NameA 111111
NameA 111111
NameB 222222
NameD 444444

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-09-12 : 14:26:34
quote:
Originally posted by 19Jon

Hi there I am very new to SQL and would appreciate any help. I have created a view using unique names and corresponding IDs from a previously built table. I built the view by right clicking on view and selecting create view instead of using build new query. My question is... what does "select queries that count the number of records will produce unique lists" mean? I was asked to make sure of this and I cannot figure what is meant by it. Can anyone help?
Thank you.

example of of view.

NameA 111111
NameA 111111
NameB 222222
NameD 444444

That question is hard to answer without a context. What are you trying to calculate or produce via the view?

Usually views are built on top of one or more tables. So your view would select data, perhaps a subset of the data, from those tables thus making it easy and secure for an end user to use that view rather than have to go to the tables to get the data.

Can you post some sample data in your source tables and your desired output? That would help someone who can respond provide more useful answers.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-09-12 : 15:51:20
i think what they meant was like if you want unique records based on group of columns, writing a select query that returns count of records for each column group will make sure you get unique list of column values

ie like

SELECT Col1,Col2,COUNT(*) AS Cnt
FROM Table
GROUP BY Col1,Col2

will give you unqiue records per each value combination of Col1 and Col2



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -