sql distinct asp





SQL Select Distinct

















Home
SQL Basics:

SQL HOME
SQL Introduction
SQL Select
SQL Where
SQL And & Or
SQL Between
SQL Distinct
SQL Order By
SQL Try It
SQL Insert
SQL Update
SQL Delete
SQL Count

SQL Advanced:

SQL Functions
SQL Group By
SQL Aliases
SQL Join
SQL Create
SQL Alter

SQL Quiz Test

Resources:

SQL Books












SQL Select Distinct




The DISTINCT keyword is used to return only distinct (different)
values.


The DISTINCT Keyword
The SQL SELECT statement returns information from table columns. But what if we only want to select
distinct elements? 
With SQL, all we need to do is to add a DISTINCT keyword to the SELECT
statement with the following syntax:



SELECT DISTINCT column-name(s) FROM table-name






Example: Select Companies from Order Table
Example: Simple Table of Purchase Orders:


Company
OrderNumber


Sega
3412


W3Schools
2312


Trio
4678


W3Schools
6798


This SQL statement:



SELECT Company FROM Orders



Will return this result:


Company


Sega


W3Schools


Trio


W3Schools



Note that the company W3Schools is listed twice in the result. Sometimes we
don't want that.


Example: Select Distinct Companies from Orders

This SQL statement:



SELECT DISTINCT Company FROM Orders



Will return this result:


Company


Sega


W3Schools


Trio


Now the company W3Schools is listed only once in the result. Sometimes that
is what we want.




Jump to : Top Of Page or HOME.


We Help you for free. Please Help us!

Help us correct errors
Help us with spelling and grammar
Tell us what you think
Link to us from your pages



All information in this Web is for training only. We do not make any warranties of its correctness or
its fitness to be used. The risk of using it remains with the user.
Copyright © 1999-2001 by Refsnes Data. All Rights Reserved.










More Tutorials:


HTML  XHTML
XML  XSL
CSS  DTD
WAP  WML
JavaScript
DHTML  Flash
VBScript  ASP
SQL  AppML






News:

The Future ofProgramming

Web Security

Browser News

Web Standards






References:

HTML 4.01 Ref

XHTML 1.0 Ref

WML 1.1 Ref

CSS Reference

XSLT Elements

ASCII Reference

Entity Reference

HTML Colors

Color Values

Color Names

WAP Pages






Validation:


HTML  XHTML
CSS  DTD
XML  WML







About W3Scripts

Please link to us








Larger Text?








 XML Partners:


















Wyszukiwarka

Podobne podstrony:
sql functions asp
sql groupby asp
sql alter asp
sql orderby asp
sql alias asp
sql create asp
sql where asp
sql quiz asp
sql count asp
sql select asp
sql insert asp
sql join asp
sql update asp
sql intro asp
sql tryit asp
sql?lete asp
sql and or asp
sql framework aug94

więcej podobnych podstron