select distinct with other columns code example
Example 1: select only distinct values from another table
INSERT INTO Table2(Id) SELECT DISTINCT Id FROM Table1 WHERE Id NOT IN(SELECT Id FROM Table2);
Example 2: select distinct on 2 columns
SELECT agent_code, ord_amount, cust_code, ord_num
FROM orders
WHERE agent_code='A002';