在mysql join query中需要帮助 - codeigniter

时间:2017-01-07 16:00:52

标签: mysql codeigniter

我在mysql中有一个包含以下数据的表

[CODE] 表名称测试

Assettype   Serial_No     Status            location    
Mouse        123456      In Stock           chennai
Mouse        98765       Allocated          chennai
Keyboard     23498       In Stock           bangalore
Keyboard     45646       Allocated          bangalore
Mouse        234234      Decommisioned      hyderabad

我正在寻找一个mysql查询,它将提供下面提到的输出

Assettype              In Stock    Allocated    Decommisioned       Location  
Mouse                   1            1             0                chennai          
Keyboard                1            1             0                bangalore
Mouse                   0            0             1                hyderabad

请帮助

1 个答案:

答案 0 :(得分:1)

您可以对资产类型和位置执行Karachi Traders 692700001 Zulfiqar Ahmad 692700002 Mian Sarfaraz 692700003 Malik Younus Commission Shop 692700004 Farhan Ashraf Commission Shop 692700006 并找到如下计数:

group by