SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help with a View
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

19Jon
Starting Member

1 Posts

Posted - 09/12/2013 :  14:21:00  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3712 Posts

Posted - 09/12/2013 :  14:26:34  Show Profile  Reply with Quote
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

India
52323 Posts

Posted - 09/12/2013 :  15:51:20  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000