Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Distinct Command
Message
 
 
To
18/12/2002 08:59:49
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00734061
Message ID:
00734069
Views:
21
Hi Ger,

The DISTINCT clause works on a record. For fiedls you can use GROUP BY
	GROUP BY 1,2 ;
However, the values in the other fields not included in the GROUP BY will be taken from the last record in the group. Also such query wouldn't work on any other backend.

>I have the following SELECT statement:
>
>SELECT DISTINCT field1   AS type1		;
>                field2   AS type2,    ;
>   	        000000   AS valcnt, 		;
>		000000   AS invcnt, 		;
>		00000000.00 AS chq_tot, 	;
>               SPACE(40) AS descr, 		;
>	       SPACE(20) AS cname, 		;
>               000000.00 AS conv_amt, 	;
>	     m.currpromo AS p_no, 		;
>	   000.000000000 AS conv_unit 	;			
>	FROM PROM ;
>	GROUP BY 1 ;
>	INTO TABLE(m.tmp_path + "tmpfile.dbf")
>	INDEX ON type1 TO c:\temp\tmpfile.idx COMPACT
>
>I want to SELECT two distinct fields (i.e. field1 & field2).
>
>How do I do this?
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform