Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the best way to do "nodupkey" ( SAS ) in mySQL ?

Can any one please let me know what would be the most efficient way the create "nodupkey" like in mySQL thay would give the same result as SAS code here ?

  Proc sort data=T1 nodupkey out = T2; By ID; Run;

Thanks

like image 451
JPC Avatar asked Dec 06 '25 10:12

JPC


1 Answers

seems like a simple distinct could be enough for your case, so your MySQL code should look like this:

create table T2 
 select distinct ID
 from T1

More information can be found here

Hope this help

EDIT:

As Mozan say this is supposed to work only if you have a single varible on your table, named ID

like image 168
Piwakkio Avatar answered Dec 08 '25 01:12

Piwakkio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!