A bit difficult to explain this one. I have a table of transactions which contains multiple entries of names. I want to scan this table and create a unique entry for each name in a second table. For instance table 1 contains :-
john smith pete jones sue james john smith john smith pete jones sue james john smith
after the query I want table 2 to contain:-
john smith pete jones sue james
thanks for any advice
You got to use DISTINCT
keyword in sql. It selects distinct values.
SELECT DISTINCT name from table_1
And you will retrieve unique names. And all you have to do is to loop through in the search result and do an INSERT
statement to insert to your new table.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments