I need to filter duplicates, but union is displaying duplicates.

```
For example Query-1 is displaying 5 tuples like 1,2,3,4,5.
Query-2 generating 3 tuples like 1,2,6.
Union of both the tuples displaying result 1,2,3,4,5,1,2,6.
But I want the result as 1,2,3,4,5,6.

```

Here is my controller :

```
public function product()
{
    $product = $this->input->post('keyword');
    $temp = explode(" ", $product);
    $count = count($temp);
    for($i=0;$i<$count;$i++)
    {
        $query = "SELECT * FROM `product` WHERE SOUNDEX(`name`) LIKE CONCAT('%',SOUNDEX('$temp[$i]'),'%') UNION SELECT * FROM `product` WHERE `name` like '%$temp[$i]%'";
        $data = $this->Back_model->getby_query($query);
        $records = json_encode($data);
        echo $records;
    }
}  

```