多列我有類似以下MySQL的 - 組由同一個表
sno | booking_id | room_type | gender | age | amount | days
1 | 2016JUL001 | AC | Male | 25 | 1000 | 15
2 | 2016JUL001 | AC | Male | 42 | 1000 | 15
3 | 2016JUL001 | AC | Male | 28 | 1000 | 15
4 | 2016JUL010 | N AC | Female | 45 | 1000 | 15
5 | 2016JUL010 | N AC | Female | 46 | 1000 | 15
6 | 2016JUL005 | N AC | Male | 28 | 1000 | 15
7 | 2016JUL005 | N AC | Female | 35 | 1000 | 15
8 | 2016JUL009 | AC | Female | 26 | 1000 | 15
9 | 2016JUL009 | AC | Female | 25 | 1000 | 15
表...等等
預期輸出[如果我想獲得性別=「女」]
sno | booking_id | room_type | gender | age | amount | days
4 | 2016JUL010 | N AC | Female | 45 | 1000 | 15
5 | 2016JUL010 | N AC | Female | 46 | 1000 | 15
8 | 2016JUL009 | AC | Female | 26 | 1000 | 15
9 | 2016JUL009 | AC | Female | 25 | 1000 | 15
預期輸出[如果我想獲得性別= '男']
sno | booking_id | room_type | gender | age | amount | days
1 | 2016JUL001 | AC | Male | 25 | 1000 | 15
2 | 2016JUL001 | AC | Male | 42 | 1000 | 15
3 | 2016JUL001 | AC | Male | 28 | 1000 | 15
預期輸出[如果我想獲得性別=「男」,性別=「女」]
sno | booking_id | room_type | gender | age | amount | days
6 | 2016JUL005 | N AC | Male | 28 | 1000 | 15
7 | 2016JUL005 | N AC | Female | 35 | 1000 | 15
注:我想3個分開的單個查詢,以得到上面的輸出
在由於推進
問題是什麼? – sagi
請閱讀完整的文章,我已經提到了3個預期的輸出和查詢要修改@sagi –
sathvik能否請你擴展你的問題 –