Show/Hide Toolbars

Filopto Help Manual

 

To throw in one more twist, we will also want the list alphabetized by LastName, then by FirstName (on a LastName tie). Thus, we will use the ORDER BY clause.  The ORDER BY clause can be specified with the type of order to use.  For example your can "ORDER BY  Lastname ASC"  which is the default setting of Ascending or you can "ORDERBY Lastname DESC" which is in the Descending order.

 

 SELECT DISTINCT SELLERID, OWNERLASTNAME, OWNERFIRSTNAME

 FROM ANTIQUES, ANTIQUEOWNERS

 WHERE SELLERID = OWNERID

 ORDER BY OWNERLASTNAME, OWNERFIRSTNAME;

 

In this example, since everyone has sold an item, we will get a listing of all of the owners, in alphabetical order by last name. For future reference (and in case anyone asks), this type of join is considered to be in the category of inner joins.