ผลต้องการหาผลรวมของตารางที่ 1 แล้วเอาผลรวมไปลบกับตารางที่ 2 ครับ
โดยที่ยืดจากการเหมือนกันของค่าอะครับ
A
data_ta room_id season_ta in_ta
1 8400 1 50
1 8400 1 50
1 8050 1 20
addroom
name_room num_room
8400 200
8050 50
อยากให้มันแบบว่า
200 - 50 -50 =100
50 - 20 = 30
8400 = 100
8050 = 30
โด้คประมานนี้ ไม่รุ้ถูกไหมครับ
SELECT data_ta,room_ta,season_ta, SUM(in_ta) as test FROM (A INNER JOIN addroom ON addroom.name_room = A.room_ta )GROUP BY data_ta,room_ta,season_ta";
ผลต้องการหาผลรวมของตารางที่ 1 แล้วเอาผลรวมไปลบกับตารางที่ 2 ครับ
โดยที่ยืดจากการเหมือนกันของค่าอะครับ
A
data_ta room_id season_ta in_ta
1 8400 1 50
1 8400 1 50
1 8050 1 20
addroom
name_room num_room
8400 200
8050 50
อยากให้มันแบบว่า
200 - 50 -50 =100
50 - 20 = 30
8400 = 100
8050 = 30
โด้คประมานนี้ ไม่รุ้ถูกไหมครับ
SELECT data_ta,room_ta,season_ta, SUM(in_ta) as test FROM (A INNER JOIN addroom ON addroom.name_room = A.room_ta )GROUP BY data_ta,room_ta,season_ta";