Hi, I am using a proc SQL procedure, and I find a difference in the number of rows between the following queries in SAS. proc sql;
create table flash.test1 as
select distinct profile_number, sas_id, min(flash_signup_date) as mindate format=Date9.
from one.subscriptions where is_flash EQ '1'
and signup_date GT canceled_date
group by profile_number;
quit;
proc sql;
create table flash.test1 as
select profile_number, sas_id, min(flash_signup_date) as mindate format=Date9.
from one.subscriptions where is_flash EQ '1'
and signup_date GT canceled_date
group by profile_number;
quit; I understand if the column sas_id was not present, there would be no use of the distinct statement with a group by clause. But can someone clarify how the distinct in the above SQL statements changes the grouping when used with another additional column? Fun fact: Any combination of distinct and group by throws an error in other DBMS (tested on a couple)
... View more