dousi2013 2014-09-09 10:01
浏览 42

内部加入PHP代码MySQL

I'm trying to do some code that retrieves me the total of inscriptions in my database. I have a table with the data for the athlets, and another table with the payment information. But, the problem is when i have a group. If i have a group, 2 or more athlets become a single row in payment table with just the number of the first athlet.

When i try to output the total of inscriptions, a group shows only 1 inscription instead of the real number that could be 2 or more.

At the moment i'm using

$result10 = mysql_query("SELECT * FROM atleta 
     INNER JOIN inscricao ON atleta.id_atleta=inscricao.atleta_id_atleta
     WHERE inscricao.parceiro_id_parceiro ='52'");

Atleta is the table with the data for athlets. Inscricao is the table with the payment info. parceiro_id_parceiro is the access that i used for the inscription.

  • 写回答

1条回答 默认 最新

  • drxnfdx798517235 2014-09-09 10:09
    关注

    EDITED try this:

    $result10 = mysql_query("SELECT * FROM atleta where atleta.id_atleta =(select inscricao.atleta_id_atleta from  inscricao  WHERE parceiro_id_parceiro ='52'"));
    
    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程