กระทู้เก่าบอร์ด อ.Yeadram
1,274 1
URL.หัวข้อ /
URL
ให้ Query แสดงผลตามที่ต้องการ
เรียน อาจารย์ทุกท่านครับ
ผมสร้าง Query ขึ้นมาเพื่อให้นับว่า ชั้น[class]......... มีเพศ [sex] หญิง-ชาย จำนวนเท่าไหร่ โดยถ้าให้ Query แสดงในรูปแบบ SQL คือ
SELECT First(student.sex) AS sex, First(student.class) AS class, Count(student.sex) AS จำนวนที่ซ้ำ
FROM student
GROUP BY student.sex, student.class
HAVING (((Count(student.sex))>1) AND ((Count(student.class))>1));
ปรากฎว่าเมื่อ run Query แล้วเขาแสดงออกมาดังนี้ครับ
sex class จำนวนที่ซ้ำ
1 ม.1/1 10
1 ม.1/10 21
1 ม.1/11 20
1 ม.1/2 17
1 ม.1/3 17
1 ม.1/4 13
2 ม.1/1 34
2 ม.1/10 22
2 ม.1/11 23
2 ม.1/2 27
2 ม.1/3 27
2 ม.1/4 30
แต่ผมต้องการให้เมื่อ run Query แล้ว ให้มันแสดงดังนี้จะได้ไหมครับ
class จำนวนที่ซ้ำsex1 จำนวนที่ซ้ำsex2 รวมทั้งหมด
ม.1/1 10 34 44
ม.1/10 21 22 43
ม.1/11 20 23 43
ม.1/2 17 27 44
ม.1/3 17 27 44
ม.1/4 13 30 43
ผมสร้าง Query ขึ้นมาเพื่อให้นับว่า ชั้น[class]......... มีเพศ [sex] หญิง-ชาย จำนวนเท่าไหร่ โดยถ้าให้ Query แสดงในรูปแบบ SQL คือ
SELECT First(student.sex) AS sex, First(student.class) AS class, Count(student.sex) AS จำนวนที่ซ้ำ
FROM student
GROUP BY student.sex, student.class
HAVING (((Count(student.sex))>1) AND ((Count(student.class))>1));
ปรากฎว่าเมื่อ run Query แล้วเขาแสดงออกมาดังนี้ครับ
sex class จำนวนที่ซ้ำ
1 ม.1/1 10
1 ม.1/10 21
1 ม.1/11 20
1 ม.1/2 17
1 ม.1/3 17
1 ม.1/4 13
2 ม.1/1 34
2 ม.1/10 22
2 ม.1/11 23
2 ม.1/2 27
2 ม.1/3 27
2 ม.1/4 30
แต่ผมต้องการให้เมื่อ run Query แล้ว ให้มันแสดงดังนี้จะได้ไหมครับ
class จำนวนที่ซ้ำsex1 จำนวนที่ซ้ำsex2 รวมทั้งหมด
ม.1/1 10 34 44
ม.1/10 21 22 43
ม.1/11 20 23 43
ม.1/2 17 27 44
ม.1/3 17 27 44
ม.1/4 13 30 43
1 Reply in this Topic. Dispaly 1 pages and you are on page number 1
Time: 0.2862s
http://www.ms-access2010.com/tutorials/download.html