tags:

views:

17

answers:

1
+1  Q: 

mysql query issue

Let's assume I have the below table

mysql> desc countrylist;  
+---------+-------------+------+-----+---------+-------+  
| Field   | Type        | Null | Key | Default | Extra |  
+---------+-------------+------+-----+---------+-------+  
| country | varchar(32) | YES  |     | NULL    |       |  
+---------+-------------+------+-----+---------+-------+  
1 row in set (0.02 sec)  

While querying the table, I always want 'USA' in the result whether or not the value is there in the table, in addition to other countries in the table. How do I handle that?

TIA.

James.

+3  A: 

You can use UNION:

SELECT country FROM countrylist
UNION
SELECT 'USA'
Mark Byers
Oh thanks a lot. That was QUICK!
James
but its be twice in some cases ?
Haim Evgi
@haim evgi: The default behavior for UNION is that duplicate rows are removed from the result.
Mark Byers
you right i dont know this , +1
Haim Evgi
Btw, is there a way to do it without a Union? Using a single SELECT statement?
James