dongzhunnai0140 2013-02-15 02:25
浏览 29
已采纳

如何将表收件箱与表电话簿关联? [关闭]

i have problem with my project for my office

my table

tbl_phonebook
number     name
0814432     ahmad

tbl_inbox
SenderNumb     text
0814432          coba coba
0942042          sekalian

how to display data from the table inbox if the same number in the inbox with the number in the phonebook table displays the name and number in the inbox if there are no / not the same as the number in phonebook table shows the number of the original sender

tq before

  • 写回答

1条回答 默认 最新

  • donglao6169 2013-02-15 02:33
    关注

    I'm not completely sure I understand your problem. I think you want to use LEFT JOIN to see if the record exists in the phonebook table.

    And perhaps use IFNULL to show the name or the sendernumb:

    SELECT i.sendernumb,
        IFNULL(p.name,i.sendernumb) name,
        i.text text
    FROM tbl_inbox i
        LEFT JOIN tbl_phonebook p ON i.SenderNumb = p.number
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料