Click here to Skip to main content
16,016,570 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
------------------------+--------+-----------------------+--------------+
| ------------------------+--------+-----------------------+--------------+
| concat(date1,agent_no) | number | concat(date,agent_id) | number_event |
+------------------------+--------+-----------------------+--------------+
| 2013-08-2415540001 | 5 | NULL | NULL |
| 2013-08-2317860006 | 1 | NULL | NULL |
| 2013-08-2217860006 | 2 | NULL | NULL |
| 2013-08-2117860006 | 1 | NULL | NULL |
| 2013-08-2017860006 | 2 | NULL | NULL |
| 2013-08-1617860006 | 1 | NULL | NULL |
| 2013-08-1417860006 | 1 | NULL | NULL |
| 2013-08-0817860001 | 44 | 2013-08-0817860001 | 75 |
| 2013-08-0817860001 | 44 | 2013-08-0817860006 | 66 |
| 2013-08-0817860006 | 84 | 2013-08-0817860001 | 75 |
| 2013-08-0817860006 | 84 | 2013-08-0817860006 | 66 |
| 2013-08-0713630037 | 5 | NULL | NULL |
| 2013-08-0310010001 | 2 | NULL | NULL |
| 2013-07-0113630002 | 5 | NULL | NULL |
| 2013-07-0113630021 | 3 | NULL | NULL |
| 2013-07-0113630026 | 10 | NULL | NULL |
| 2013-07-0113630034 | 1 | NULL | NULL |
| 2013-06-2813630002 | 235 | NULL | NULL |
| 2013-06-2213630002 | 1313 | NULL | NULL |
| 2013-06-2113630002 | 806 | NULL | NULL |
| 2013-06-1913630002 | 1 | NULL | NULL |
| 2013-05-0313630034 | 1 | 2013-05-0313630036 | 3 |
| 2013-05-0313630036 | 1 | 2013-05-0313630036 | 3 |
| 2013-05-0213630028 | 1 | NULL | NULL |
| 2013-04-3013630026 | 2 | 2013-04-3013630026 | 2 |
| 2013-04-2913630026 | 3 | 2013-04-2913630026 | 2 |
| 2013-04-2513630026 | 1 | 2013-04-2513630021 | 1 |
| NULL | 7 | NULL | NULL |
| NULL | 1 | NULL | NULL |
| NULL | NULL | 2013-06-0511020001 | 6 |
| NULL | NULL | 2013-05-2413630037 | 6 |
| NULL | NULL | 2013-05-2313630037 | 12 |
| NULL | NULL | 2013-05-2213630037 | 6 |
| NULL | NULL | 2013-05-2113630026 | 1 |
+------------------------+--------+-----------------------+--------------+
34 rows in set (0.02 sec)


I have a table in mysql.... in this I want to create a query which will fetch all the unique values from concat(date1,agent_no) and concat(date,agent_id) with their corresonding values for number and number_event.....in case any of these fields dont exist, it should show null.
Posted
Comments
ZurdoDev 26-Aug-13 8:07am    
OK, so where are you stuck?
Sanjeev236 26-Aug-13 8:30am    
my query providing me incorrect set of data.
used left outer join union right outer join.
ZurdoDev 26-Aug-13 8:37am    
How can we help?
Sanjeev236 26-Aug-13 8:51am    
it would be gr8.. if u can suggest me query.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900