Lin:

 

That all depends on what you're wanting to accomplish.  Obviously the more
columns you specify in your SELECT statement the less DISTINCTness there's
going to be.

 

Have you checked out the GROUP BY clause of a SELECT statement?  It can be a
powerful tool.

 

Here's an example from one of my database:

 

SELECT MELTCODE,COUNT(*),SUM(POUNDS) FROM REJECT GROUP BY MELTCODE

 

MELTCODE COUNT (*)  SUM (POUNDS)    

-------- ---------- --------------- 

111-10          196         576,765

151-15            4          30,150

151-21            2          33,370

174-20         1057         681,820

180-21          158         200,319

181-21          469       1,763,874

182-20          228         855,215

 

This command displays a "distinct" record for each MELTCODE in my REJECT
table.  In addition to this I aggregated the MELTCODE by having R:BASE give
me a count of all records where a given MELTCODE exists plus a total of the
POUNDS column.

 

Again it gets back to what you need to accomplish.

 

Hope this helps.

 

Mike Ramsour 
AK Steel Coshocton Works 
Quality Department 

Phone/VMS:  740-829-4340 

  _____  

From: Lin MacDonald [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 21, 2008 7:13 PM
To: [email protected]
Subject: [RBASE-L] - select distinct...

 

I need a push with the 'select distinct' command. My brain just isn't
following along!

 

I want to select all rows in my view (dependant on my 'where' clause), but I
only want one instance of each Company to show.  Is there a way to use
Select * from... yet still use 'distinct' or do I need to select (and list)
each column ?

 

thanks,

 

Lin

Reply via email to