有两个表
表A
单号,数量,价格
001 4 500
002 2 1000
003 3 600
表B
单号,付款方式,付款金额
001 1 200
001 2 300
002 2 1000
003 1 400
003 2 200
如何查处如下结果
单号,数量,价格,付款方式,付款金额,付款方式,付款金额
001 4 500 1 200 2 300
002 2 1000 2 1000
003 3 600 1 400 2 200
表A
单号,数量,价格
001 4 500
002 2 1000
003 3 600
表B
单号,付款方式,付款金额
001 1 200
001 2 300
002 2 1000
003 1 400
003 2 200
如何查处如下结果
单号,数量,价格,付款方式,付款金额,付款方式,付款金额
001 4 500 1 200 2 300
002 2 1000 2 1000
003 3 600 1 400 2 200
解决方案 »
- access数据库中的数据能导入到mysql中吗?
- 安装Joomla!配置mysql数据库时候出错?
- PostgreSQL-PL/pgSQL教程--基本语句
- Mysql Grant 失败
- 在租用空间里用phpMyAdmin插入的中文在页面上用utf-8读出来为什么是乱码?
- 如何查看mysql的log??
- C# MysQL用longblob字段存入二进制文件
- order by 出现 filesort
- PHP连接mysql时出现Fatal error: Call to undefined function mysql_connect()
- 求一个mysql语句
- MySql数据库中主键的索引是什么样的?
- 散分了,第一次用postgreSQL,求科普各种下限问题
1 as 付款方式1,
sum(if(付款方式=1,付款金额,0)) as 付款金额1
2 as 付款方式1,
sum(if(付款方式=2,付款金额,0)) as 付款金额2
from a left join b on a.单号=b.单号
group by a.单号