php mysql“根据日期显示事件名称”

时间:2015-08-13 01:26:19

标签: php mysql

如何根据日期显示事件表中的事件名称。

enter image description here

enter image description here

这是我的代码iwant to add the script is this code。

$sql = "
SELECT `log`.id, (student.id) as ids, student.name,event, student.`year`, student.section, `log`.date_log, `log`.time_log, `log`.ampm, `log`.status_log, section.sec_name 
FROM `log` 
  Inner Join student ON student.cardcode = `log`.stud_id 
  Inner Join section ON section.id = student.section 
order by `log`.id DESC limit $start, $per_page";

2 个答案:

答案 0 :(得分:0)

使用这个sql:

LinearLayout

答案 1 :(得分:0)

试试这个:

UPDATE `log` SET `event` = (SELECT `event_name` FROM `event` WHERE `date` = log.date_log)

修改

基于PHP编码:

UPDATE log AS L 
INNER JOIN event AS E ON L.date_log = E.date
SET L.event = E.event_name