SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as sumval
where a.month(datemeet)='2016-07-04' and a.year(datemeet)='2016-07-04'
FROM product_er a
ORDER BY a.datemeet ASC,wage ASC
SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as sumval
where a.datemeet LIKE '2016-07-%'
FROM product_er a
ORDER BY a.datemeet ASC,wage ASC
<?
$sql = "SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as acute1_1 FROM product_er a WHERE a.datemeet LIKE '$s_month%'";
$sql .="FROM product_er a";
$sql .="ORDER BY a.datemeet ASC,a.wage ASC";
$c_sql=mysql_db_query($dbname,$sql);
while($f_room=mysql_fetch_array($c_sql) or die( $sql . "<br>".mysql_error())) {
if($nr++%2==1) $trclass='BgSky'; else $trclass='BgSky2';
?>
<?}?>
<?
$sql = "
SELECT a.*,
(SELECT SUM(b.acute1) FROM product_er b
WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as acute1_1
FROM product_er a WHERE a.datemeet LIKE '".$s_month."%'
ORDER BY a.datemeet ASC,a.wage ASC
";
$c_sql=mysql_db_query($dbname,$sql);
if($c_sql){
while($f_room=mysql_fetch_array($c_sql)) {
if($nr++%2==1) $trclass='BgSky'; else $trclass='BgSky2';
?>
//แทรกตารางตรงนี้น่ะ
<? }?>
<?}?>
<?php
$sql = "SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as acute1_1 FROM product_er a WHERE a.datemeet LIKE '05'";
$sql .="FROM product_er a";
$sql .="ORDER BY a.datemeet ASC,a.wage ASC";
$c_sql=mysql_db_query($dbname,$sql);
while($f_room=mysql_fetch_array($c_sql) or die( $sql . "<br>".mysql_error())) {
if($nr++%2==1) $trclass='BgSky'; else $trclass='BgSky2';
?>
$s_month% ลองใส่เลขเดือนแทนในตัวแปรที่มีข้อมูลเดือนอยู่จะออกมั้ย
<?php } ?>
<?php
$sql = "SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as acute1_1 FROM product_er a WHERE DATE_FORMAT(a.datemeet,'%m') = '$s_month'";
$sql .="FROM product_er a";
$sql .="ORDER BY a.datemeet ASC,a.wage ASC";
$c_sql=mysql_db_query($dbname,$sql);
while($f_room=mysql_fetch_array($c_sql) or die( $sql . "<br>".mysql_error())) {
if($nr++%2==1) $trclass='BgSky'; else $trclass='BgSky2';
?>
<?php } ?>
<?php
$sql = "SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as acute1_1 FROM product_er a WHERE DATE_FORMAT(a.datemeet,'%m') = '$s_month'";
$sql .="FROM product_er a";
$sql .="ORDER BY a.datemeet ASC,a.wage ASC";
$c_sql=mysql_db_query($dbname,$sql) or die( $sql . "<br>".mysql_error());
while($f_room=mysql_fetch_array($c_sql)) {
if($nr++%2==1) $trclass='BgSky'; else $trclass='BgSky2';
?>
<?php } ?>
ที่ผมทำ ณ ตอนนี้
<?php
$sql = "SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as acute1_1 FROM product_er a WHERE DATE_FORMAT(a.datemeet,'%m') = '$s_month'";
$sql .="FROM product_er a";
$sql .="ORDER BY a.datemeet ASC,a.wage ASC";
$c_sql=mysql_db_query($dbname,$sql) or die( $sql . "<br>".mysql_error());
while($f_room=mysql_fetch_array($c_sql) ) {
if($nr++%2==1) $trclass='BgSky'; else $trclass='BgSky2';
?>
$sql = "SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as acute1_1 FROM product_er a WHERE DATE_FORMAT(a.datemeet,'%m') = '$s_month'"; $sql .="FROM product_er a";
บันทัดสีแดง คุณคงไว้ทำไมครับ เพิ่มที่สีนำเงินแล้ว
ปล. ต่อ text ก็ดูวรรคตอนให้ดีด้วยครับ มันจะติดกัน ทำให้ โค๊ดเสียอีก
<?
$sql = "SELECT a.*,(SELECT SUM(b.acute1) FROM product_er b WHERE b.datemeet=a.datemeet GROUP BY b.datemeet) as acute1_1 FROM product_er a WHERE DATE_FORMAT(a.datemeet,'%m') = '$s_month' and DATE_FORMAT(a.datemeet,'%y') = '$s_year' ";
$sql .="ORDER BY a.datemeet ASC,a.wage ASC";
$c_sql=mysql_db_query($dbname,$sql) or die( $sql . "<br>".mysql_error());
while($f_room=mysql_fetch_array($c_sql) ) {
if($nr++%2==1) $trclass='BgSky'; else $trclass='BgSky2';
?>
//แทรกตาราง