select * from voicefiles where associate='1274871406779944';
+-------+-------------------------------------+---------+--------+---------------------+-------------+------------+------------------+-------------------------+----------+---------------+
| id    | filename                            | extname | folder | cretime             | description | label      | associate        | args                    | readonly | mailprocessed |
+-------+-------------------------------------+---------+--------+---------------------+-------------+------------+------------------+-------------------------+----------+---------------+
| 12321 | SAM_1274871406779944_1274871407_515 | WAV     | 1      | 2010-05-26 18:56:47 |             | sysautomon | 1274871406779944 | type=callee&number=8008 |        0 |             0 |
| 12319 | SAM_1274871406779944_1274871407_690 | WAV     | 1      | 2010-05-26 18:56:47 |             | sysautomon | 1274871406779944 | type=callee&number=8007 |        0 |             0 |
| 12320 | SAM_1274871406779944_1274871407_142 | WAV     | 1      | 2010-05-26 18:56:47 |             | sysautomon | 1274871406779944 | type=callee&number=8006 |        0 |             0 |
| 12322 | SAM_1274871406779944_1274871407_109 | WAV     | 1      | 2010-05-26 18:56:47 |             | sysautomon | 1274871406779944 | type=callee&number=8005 |        0 |             0 |
+-------+-------------------------------------+---------+--------+---------------------+-------------+------------+------------------+-------------------------+----------+---------------+
4 rows in set (0.01 sec)mysql> select * from cdr where userfield like '1274871406779944%';
+-------+---------------------+-----------------------------+-------------+------+---------------------+---------------------------------------+---------------------------------------+---------+-----------------------------------------------------------+----------+---------+-------------+----------+-------------+---------------------------------------------+----------+
| id    | calldate            | clid                        | src         | dst  | dcontext            | channel                               | dstchannel                            | lastapp | lastdata                                                  | duration | billsec | disposition | amaflags | accountcode | userfield                                   | uniqueid |
+-------+---------------------+-----------------------------+-------------+------+---------------------+---------------------------------------+---------------------------------------+---------+-----------------------------------------------------------+----------+---------+-------------+----------+-------------+---------------------------------------------+----------+
| 17045 | 2010-05-26 18:56:46 | "13525242689" <13525242689> | 13525242689 | 8007 | sub-queuefindnumber | Local/8007@sub-queuefindnumber-489b,2 | DAHDI/7-1                             | Dial    | DAHDI/7|40|t                                              |        6 |       0 | NO ANSWER   |        3 |             | 1274871406779944,freeiris2-1274871406.31060 |          |
| 17046 | 2010-05-26 18:56:46 | "13525242689" <13525242689> | 13525242689 | 8005 | sub-queuefindnumber | Local/8005@sub-queuefindnumber-4797,2 | DAHDI/5-1                             | Dial    | DAHDI/5|40|t                                              |        6 |       0 | NO ANSWER   |        3 |             | 1274871406779944,freeiris2-1274871406.31064 |          |
| 17047 | 2010-05-26 18:56:46 | "13525242689" <13525242689> | 13525242689 | 8008 | sub-queuefindnumber | Local/8008@sub-queuefindnumber-47b7,2 | DAHDI/8-1                             | Dial    | DAHDI/8|40|t                                              |        6 |       0 | NO ANSWER   |        3 |             | 1274871406779944,freeiris2-1274871406.31066 |          |
| 17048 | 2010-05-26 18:56:46 | "13525242689" <13525242689> | 13525242689 | 8006 | sub-queuefindnumber | Local/8006@sub-queuefindnumber-6a17,2 | DAHDI/6-1                             | Dial    | DAHDI/6|40|t                                              |       17 |      11 | ANSWERED    |        3 |             | 1274871406779944,freeiris2-1274871406.31062 |          |
| 17049 | 2010-05-26 18:56:43 | "13525242689" <13525242689> | 13525242689 | 401  | from-trunk-dahdi    | DAHDI/1-1                             | Local/8006@sub-queuefindnumber-6a17,1 | Queue   | 401|t|||300|agi://127.0.0.1/queue_answeragent?saymember=0 |       20 |      11 | ANSWERED    |        3 | 0           | 1274871406779944,freeiris2-1274871403.31058 |          |
+-------+---------------------+-----------------------------+-------------+------+---------------------+---------------------------------------+---------------------------------------+---------+-----------------------------------------------------------+----------+---------+-------------+----------+-------------+---------------------------------------------+----------+
5 rows in set (0.04 sec)mysql> select * from callsession where id='1274871406779944';
+------------------+-------------+--------------+-----------+------------+---------------------+----------------------------+
| id               | accountcode | callernumber | extension | routerline | cretime             | frist_cdruniqueid          |
+------------------+-------------+--------------+-----------+------------+---------------------+----------------------------+
| 1274871406779944 | 0           | 13525242689  | 401       |          2 | 2010-05-26 18:56:46 | freeiris2-1274871403.31058 |
+------------------+-------------+--------------+-----------+------------+---------------------+----------------------------+
1 row in set (0.00 sec)

解决方案 »

  1.   


    想实现什么?   参考一下这个贴子的提问方式http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html
       
       1. 你的 create table xxx .. 语句
       2. 你的 insert into xxx ... 语句
       3. 结果是什么样,(并给以简单的算法描述)
       4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL)
       
       这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。   
      

  2.   

    voicefiles 中的 args字段 的值为 type=callee&number=8008这个字段的格式为 
    先&号分割 
    然后取2个字符 再 = 分割 取如何取后面那个 8008然后与第2个表关联????voicefiles 表中 args字段 (值为 type=callee&number=8008) 和 cdr 表中的字段 dst字段(值为8008) 关联。
    请问如何实现mysql 不熟悉
      

  3.   

    楼主能认真看一下回复吗?   3. 结果是什么样,(并给以简单的算法描述)
     (不要高估你的汉语表达能力或者我的汉语理解能力)
       建议你列出你的表结构,并提供测试数据以及基于这些测试数据的所对应正确结果。
       参考一下这个贴子的提问方式http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html
       
       1. 你的 create table xxx .. 语句
       2. 你的 insert into xxx ... 语句
       3. 结果是什么样,(并给以简单的算法描述)
       4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL)
       
       这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。   
      

  4.   

    要啥样的结果呢?  select * from voicefiles a,cdr b where b.dst=
    right(a.args,locate('=',reverse(a.args))-1);
    以上纯属猜测
      

  5.   

    楼主死活不肯看一下别人是怎么高效的提问的。打死也不肯贴出 " 3. 结果是什么样,(并给以简单的算法描述)"
    select * from voicefiles表 a inner join cdr b on a.SUBSTRING_INDEX(args,'=',-1) =b.dst字段