skania Posted January 31, 2014 Share Posted January 31, 2014 Php/sql novice here. :/ I've got a table that has id(auto-incrementing), student_id(primary key), student_name(varchar), swipe_in(date_time), swipe_out(date_time). I'm working on a web database that'll streamline attendance tracking for professors at a university. One of the reports requested is "By student". The professor would like headers across the top, and under each - the date if the student attended, and blank if the student failed to attend. Here are the problems I'm coming into: I have the headers with: $sql = "SELECT DISTINCT DATE(swipe_in) AS swipe_date from attendance"; $list = mysqli_query($dbcon, $sql); while($record = mysqli_fetch_assoc($list)){ echo "<th>" . $record['swipe_date'] . "</th>"; } I need to then print out the students that attended on that date. So that each student will either have "yes" or "no" (or something of that nature, or 0 or 1). But this brings me into a secondary problem: Students appear to enjoy double swiping their student identification cards "just in case" I suppose. There are multiple records in the database that have the same date but differ by ~10 seconds. I need to make sure I only check on one of those dates, I don't want each record to print. :S If possible, I would like to find a solution that does not deal with a hands on approach in the database - as this will all be automated in the end. So if I can accomplish the record problem without having to do something in the database each time I want a report would be best. The table in the database can be changed, but the input file is from a script that inserts into the database, essentially looks the same. Any ideas? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/285829-select-unique-records-aggregating-on-a-date-in-datetime-format/ Share on other sites More sharing options...
kicken Posted January 31, 2014 Share Posted January 31, 2014 (edited) SELECT DISTINCT student_id , DATE(swipe_in) FROM attendance That should get you a list of the students and the date when they swiped in. The DATE function extracts only the date portion of the datetime value so two swipes on the same day but different times would still be filtered to a single entry as a result of the DISTINCT operation. If you need to display the exact time they swiped in and not just a yes/no for the date, then you could use group by on the date portion: SELECT student_id , MIN(swipe_in) FROM attendance GROUP BY student_id , DATE(swipe_in) Edited January 31, 2014 by kicken Quote Link to comment https://forums.phpfreaks.com/topic/285829-select-unique-records-aggregating-on-a-date-in-datetime-format/#findComment-1467236 Share on other sites More sharing options...
Barand Posted January 31, 2014 Share Posted January 31, 2014 You sholdn't be repeating the students' names in every attendance record. The name should be stored once in a student table. Only the ids should be in both tables. That said, here's one way My test data +-----+------------+--------------+---------------------+---------------------+ | id | student_id | student_name | swipe_in | swipe_out | +-----+------------+--------------+---------------------+---------------------+ | 1 | 1 | Student 1 | 2014-01-06 08:36:00 | 2014-01-06 15:30:00 | | 2 | 1 | Student 1 | 2014-01-06 08:36:00 | 2014-01-06 15:30:00 | | 3 | 1 | Student 1 | 2014-01-06 08:36:00 | 2014-01-06 15:30:00 | | 4 | 2 | Student 2 | 2014-01-06 08:34:00 | 2014-01-06 15:30:00 | | 5 | 2 | Student 2 | 2014-01-06 08:34:00 | 2014-01-06 15:30:00 | | 6 | 2 | Student 2 | 2014-01-06 08:34:00 | 2014-01-06 15:30:00 | | 7 | 3 | Student 3 | 2014-01-06 08:29:00 | 2014-01-06 15:30:00 | | 8 | 4 | Student 4 | 2014-01-06 08:40:00 | 2014-01-06 15:30:00 | | 9 | 4 | Student 4 | 2014-01-06 08:40:00 | 2014-01-06 15:30:00 | | 10 | 4 | Student 4 | 2014-01-06 08:40:00 | 2014-01-06 15:30:00 | | 11 | 5 | Student 5 | 2014-01-06 08:32:00 | 2014-01-06 15:30:00 | | 12 | 5 | Student 5 | 2014-01-06 08:32:00 | 2014-01-06 15:30:00 | | 13 | 5 | Student 5 | 2014-01-06 08:32:00 | 2014-01-06 15:30:00 | | 14 | 7 | Student 7 | 2014-01-06 08:19:00 | 2014-01-06 15:30:00 | | 15 | 7 | Student 7 | 2014-01-06 08:19:00 | 2014-01-06 15:30:00 | | 16 | 8 | Student 8 | 2014-01-06 08:29:00 | 2014-01-06 15:30:00 | | 17 | 8 | Student 8 | 2014-01-06 08:29:00 | 2014-01-06 15:30:00 | | 18 | 10 | Student 10 | 2014-01-06 08:32:00 | 2014-01-06 15:30:00 | | 19 | 1 | Student 1 | 2014-01-07 08:22:00 | 2014-01-07 15:30:00 | | 20 | 1 | Student 1 | 2014-01-07 08:22:00 | 2014-01-07 15:30:00 | | 21 | 2 | Student 2 | 2014-01-07 08:39:00 | 2014-01-07 15:30:00 | | 22 | 2 | Student 2 | 2014-01-07 08:39:00 | 2014-01-07 15:30:00 | | 23 | 2 | Student 2 | 2014-01-07 08:39:00 | 2014-01-07 15:30:00 | | 24 | 3 | Student 3 | 2014-01-07 08:44:00 | 2014-01-07 15:30:00 | | 25 | 3 | Student 3 | 2014-01-07 08:44:00 | 2014-01-07 15:30:00 | | 26 | 3 | Student 3 | 2014-01-07 08:44:00 | 2014-01-07 15:30:00 | | 27 | 4 | Student 4 | 2014-01-07 08:17:00 | 2014-01-07 15:30:00 | | 28 | 5 | Student 5 | 2014-01-07 08:24:00 | 2014-01-07 15:30:00 | | 29 | 5 | Student 5 | 2014-01-07 08:24:00 | 2014-01-07 15:30:00 | | 30 | 6 | Student 6 | 2014-01-07 08:16:00 | 2014-01-07 15:30:00 | | 31 | 7 | Student 7 | 2014-01-07 08:36:00 | 2014-01-07 15:30:00 | | 32 | 7 | Student 7 | 2014-01-07 08:36:00 | 2014-01-07 15:30:00 | | 33 | 7 | Student 7 | 2014-01-07 08:36:00 | 2014-01-07 15:30:00 | | 34 | 8 | Student 8 | 2014-01-07 08:15:00 | 2014-01-07 15:30:00 | | 35 | 8 | Student 8 | 2014-01-07 08:15:00 | 2014-01-07 15:30:00 | | 36 | 8 | Student 8 | 2014-01-07 08:15:00 | 2014-01-07 15:30:00 | | 37 | 9 | Student 9 | 2014-01-07 08:36:00 | 2014-01-07 15:30:00 | | 38 | 9 | Student 9 | 2014-01-07 08:36:00 | 2014-01-07 15:30:00 | | 39 | 9 | Student 9 | 2014-01-07 08:36:00 | 2014-01-07 15:30:00 | | 40 | 10 | Student 10 | 2014-01-07 08:23:00 | 2014-01-07 15:30:00 | | 41 | 10 | Student 10 | 2014-01-07 08:23:00 | 2014-01-07 15:30:00 | | 42 | 10 | Student 10 | 2014-01-07 08:23:00 | 2014-01-07 15:30:00 | | 43 | 1 | Student 1 | 2014-01-08 08:31:00 | 2014-01-08 15:30:00 | | 44 | 1 | Student 1 | 2014-01-08 08:31:00 | 2014-01-08 15:30:00 | | 45 | 1 | Student 1 | 2014-01-08 08:31:00 | 2014-01-08 15:30:00 | | 46 | 3 | Student 3 | 2014-01-08 08:18:00 | 2014-01-08 15:30:00 | | 47 | 4 | Student 4 | 2014-01-08 08:36:00 | 2014-01-08 15:30:00 | | 48 | 5 | Student 5 | 2014-01-08 08:21:00 | 2014-01-08 15:30:00 | | 49 | 6 | Student 6 | 2014-01-08 08:15:00 | 2014-01-08 15:30:00 | | 50 | 6 | Student 6 | 2014-01-08 08:15:00 | 2014-01-08 15:30:00 | | 51 | 6 | Student 6 | 2014-01-08 08:15:00 | 2014-01-08 15:30:00 | | 52 | 7 | Student 7 | 2014-01-08 08:45:00 | 2014-01-08 15:30:00 | | 53 | 9 | Student 9 | 2014-01-08 08:43:00 | 2014-01-08 15:30:00 | | 54 | 9 | Student 9 | 2014-01-08 08:43:00 | 2014-01-08 15:30:00 | | 55 | 9 | Student 9 | 2014-01-08 08:43:00 | 2014-01-08 15:30:00 | | 56 | 1 | Student 1 | 2014-01-09 08:33:00 | 2014-01-09 15:30:00 | | 57 | 2 | Student 2 | 2014-01-09 08:15:00 | 2014-01-09 15:30:00 | | 58 | 4 | Student 4 | 2014-01-09 08:43:00 | 2014-01-09 15:30:00 | | 59 | 5 | Student 5 | 2014-01-09 08:40:00 | 2014-01-09 15:30:00 | | 60 | 5 | Student 5 | 2014-01-09 08:40:00 | 2014-01-09 15:30:00 | | 61 | 5 | Student 5 | 2014-01-09 08:40:00 | 2014-01-09 15:30:00 | | 62 | 6 | Student 6 | 2014-01-09 08:22:00 | 2014-01-09 15:30:00 | | 63 | 7 | Student 7 | 2014-01-09 08:30:00 | 2014-01-09 15:30:00 | | 64 | 7 | Student 7 | 2014-01-09 08:30:00 | 2014-01-09 15:30:00 | | 65 | 8 | Student 8 | 2014-01-09 08:39:00 | 2014-01-09 15:30:00 | | 66 | 8 | Student 8 | 2014-01-09 08:39:00 | 2014-01-09 15:30:00 | | 67 | 10 | Student 10 | 2014-01-09 08:45:00 | 2014-01-09 15:30:00 | | 68 | 10 | Student 10 | 2014-01-09 08:45:00 | 2014-01-09 15:30:00 | | 69 | 1 | Student 1 | 2014-01-10 08:40:00 | 2014-01-10 15:30:00 | | 70 | 1 | Student 1 | 2014-01-10 08:40:00 | 2014-01-10 15:30:00 | | 71 | 2 | Student 2 | 2014-01-10 08:21:00 | 2014-01-10 15:30:00 | | 72 | 2 | Student 2 | 2014-01-10 08:21:00 | 2014-01-10 15:30:00 | | 73 | 3 | Student 3 | 2014-01-10 08:45:00 | 2014-01-10 15:30:00 | | 74 | 3 | Student 3 | 2014-01-10 08:45:00 | 2014-01-10 15:30:00 | | 75 | 3 | Student 3 | 2014-01-10 08:45:00 | 2014-01-10 15:30:00 | | 76 | 4 | Student 4 | 2014-01-10 08:26:00 | 2014-01-10 15:30:00 | | 77 | 4 | Student 4 | 2014-01-10 08:26:00 | 2014-01-10 15:30:00 | | 78 | 4 | Student 4 | 2014-01-10 08:26:00 | 2014-01-10 15:30:00 | | 79 | 5 | Student 5 | 2014-01-10 08:44:00 | 2014-01-10 15:30:00 | | 80 | 5 | Student 5 | 2014-01-10 08:44:00 | 2014-01-10 15:30:00 | | 81 | 6 | Student 6 | 2014-01-10 08:37:00 | 2014-01-10 15:30:00 | | 82 | 7 | Student 7 | 2014-01-10 08:34:00 | 2014-01-10 15:30:00 | | 83 | 7 | Student 7 | 2014-01-10 08:34:00 | 2014-01-10 15:30:00 | | 84 | 7 | Student 7 | 2014-01-10 08:34:00 | 2014-01-10 15:30:00 | | 85 | 8 | Student 8 | 2014-01-10 08:30:00 | 2014-01-10 15:30:00 | | 86 | 8 | Student 8 | 2014-01-10 08:30:00 | 2014-01-10 15:30:00 | | 87 | 8 | Student 8 | 2014-01-10 08:30:00 | 2014-01-10 15:30:00 | | 88 | 9 | Student 9 | 2014-01-10 08:39:00 | 2014-01-10 15:30:00 | | 89 | 10 | Student 10 | 2014-01-10 08:28:00 | 2014-01-10 15:30:00 | | 90 | 1 | Student 1 | 2014-01-13 08:32:00 | 2014-01-13 15:30:00 | | 91 | 1 | Student 1 | 2014-01-13 08:32:00 | 2014-01-13 15:30:00 | | 92 | 2 | Student 2 | 2014-01-13 08:23:00 | 2014-01-13 15:30:00 | | 93 | 2 | Student 2 | 2014-01-13 08:23:00 | 2014-01-13 15:30:00 | | 94 | 2 | Student 2 | 2014-01-13 08:23:00 | 2014-01-13 15:30:00 | | 95 | 3 | Student 3 | 2014-01-13 08:25:00 | 2014-01-13 15:30:00 | | 96 | 5 | Student 5 | 2014-01-13 08:26:00 | 2014-01-13 15:30:00 | | 97 | 6 | Student 6 | 2014-01-13 08:26:00 | 2014-01-13 15:30:00 | | 98 | 7 | Student 7 | 2014-01-13 08:39:00 | 2014-01-13 15:30:00 | | 99 | 7 | Student 7 | 2014-01-13 08:39:00 | 2014-01-13 15:30:00 | | 100 | 7 | Student 7 | 2014-01-13 08:39:00 | 2014-01-13 15:30:00 | | 101 | 8 | Student 8 | 2014-01-13 08:26:00 | 2014-01-13 15:30:00 | | 102 | 8 | Student 8 | 2014-01-13 08:26:00 | 2014-01-13 15:30:00 | | 103 | 8 | Student 8 | 2014-01-13 08:26:00 | 2014-01-13 15:30:00 | | 104 | 9 | Student 9 | 2014-01-13 08:26:00 | 2014-01-13 15:30:00 | | 105 | 9 | Student 9 | 2014-01-13 08:26:00 | 2014-01-13 15:30:00 | | 106 | 10 | Student 10 | 2014-01-13 08:42:00 | 2014-01-13 15:30:00 | | 107 | 10 | Student 10 | 2014-01-13 08:42:00 | 2014-01-13 15:30:00 | | 108 | 10 | Student 10 | 2014-01-13 08:42:00 | 2014-01-13 15:30:00 | | 109 | 1 | Student 1 | 2014-01-14 08:24:00 | 2014-01-14 15:30:00 | | 110 | 2 | Student 2 | 2014-01-14 08:35:00 | 2014-01-14 15:30:00 | | 111 | 2 | Student 2 | 2014-01-14 08:35:00 | 2014-01-14 15:30:00 | | 112 | 4 | Student 4 | 2014-01-14 08:33:00 | 2014-01-14 15:30:00 | | 113 | 4 | Student 4 | 2014-01-14 08:33:00 | 2014-01-14 15:30:00 | | 114 | 6 | Student 6 | 2014-01-14 08:27:00 | 2014-01-14 15:30:00 | | 115 | 6 | Student 6 | 2014-01-14 08:27:00 | 2014-01-14 15:30:00 | | 116 | 7 | Student 7 | 2014-01-14 08:33:00 | 2014-01-14 15:30:00 | | 117 | 10 | Student 10 | 2014-01-14 08:26:00 | 2014-01-14 15:30:00 | | 118 | 10 | Student 10 | 2014-01-14 08:26:00 | 2014-01-14 15:30:00 | | 119 | 10 | Student 10 | 2014-01-14 08:26:00 | 2014-01-14 15:30:00 | | 120 | 1 | Student 1 | 2014-01-15 08:17:00 | 2014-01-15 15:30:00 | | 121 | 1 | Student 1 | 2014-01-15 08:17:00 | 2014-01-15 15:30:00 | | 122 | 1 | Student 1 | 2014-01-15 08:17:00 | 2014-01-15 15:30:00 | | 123 | 3 | Student 3 | 2014-01-15 08:21:00 | 2014-01-15 15:30:00 | | 124 | 3 | Student 3 | 2014-01-15 08:21:00 | 2014-01-15 15:30:00 | | 125 | 4 | Student 4 | 2014-01-15 08:22:00 | 2014-01-15 15:30:00 | | 126 | 4 | Student 4 | 2014-01-15 08:22:00 | 2014-01-15 15:30:00 | | 127 | 5 | Student 5 | 2014-01-15 08:25:00 | 2014-01-15 15:30:00 | | 128 | 5 | Student 5 | 2014-01-15 08:25:00 | 2014-01-15 15:30:00 | | 129 | 5 | Student 5 | 2014-01-15 08:25:00 | 2014-01-15 15:30:00 | | 130 | 6 | Student 6 | 2014-01-15 08:27:00 | 2014-01-15 15:30:00 | | 131 | 7 | Student 7 | 2014-01-15 08:45:00 | 2014-01-15 15:30:00 | | 132 | 7 | Student 7 | 2014-01-15 08:45:00 | 2014-01-15 15:30:00 | | 133 | 7 | Student 7 | 2014-01-15 08:45:00 | 2014-01-15 15:30:00 | | 134 | 9 | Student 9 | 2014-01-15 08:22:00 | 2014-01-15 15:30:00 | | 135 | 10 | Student 10 | 2014-01-15 08:41:00 | 2014-01-15 15:30:00 | | 136 | 10 | Student 10 | 2014-01-15 08:41:00 | 2014-01-15 15:30:00 | | 137 | 1 | Student 1 | 2014-01-16 08:43:00 | 2014-01-16 15:30:00 | | 138 | 1 | Student 1 | 2014-01-16 08:43:00 | 2014-01-16 15:30:00 | | 139 | 2 | Student 2 | 2014-01-16 08:31:00 | 2014-01-16 15:30:00 | | 140 | 2 | Student 2 | 2014-01-16 08:31:00 | 2014-01-16 15:30:00 | | 141 | 3 | Student 3 | 2014-01-16 08:40:00 | 2014-01-16 15:30:00 | | 142 | 4 | Student 4 | 2014-01-16 08:31:00 | 2014-01-16 15:30:00 | | 143 | 5 | Student 5 | 2014-01-16 08:37:00 | 2014-01-16 15:30:00 | | 144 | 6 | Student 6 | 2014-01-16 08:41:00 | 2014-01-16 15:30:00 | | 145 | 6 | Student 6 | 2014-01-16 08:41:00 | 2014-01-16 15:30:00 | | 146 | 7 | Student 7 | 2014-01-16 08:33:00 | 2014-01-16 15:30:00 | | 147 | 7 | Student 7 | 2014-01-16 08:33:00 | 2014-01-16 15:30:00 | | 148 | 7 | Student 7 | 2014-01-16 08:33:00 | 2014-01-16 15:30:00 | | 149 | 9 | Student 9 | 2014-01-16 08:31:00 | 2014-01-16 15:30:00 | | 150 | 9 | Student 9 | 2014-01-16 08:31:00 | 2014-01-16 15:30:00 | | 151 | 10 | Student 10 | 2014-01-16 08:36:00 | 2014-01-16 15:30:00 | | 152 | 10 | Student 10 | 2014-01-16 08:36:00 | 2014-01-16 15:30:00 | | 153 | 10 | Student 10 | 2014-01-16 08:36:00 | 2014-01-16 15:30:00 | | 154 | 1 | Student 1 | 2014-01-17 08:35:00 | 2014-01-17 15:30:00 | | 155 | 1 | Student 1 | 2014-01-17 08:35:00 | 2014-01-17 15:30:00 | | 156 | 1 | Student 1 | 2014-01-17 08:35:00 | 2014-01-17 15:30:00 | | 157 | 2 | Student 2 | 2014-01-17 08:39:00 | 2014-01-17 15:30:00 | | 158 | 2 | Student 2 | 2014-01-17 08:39:00 | 2014-01-17 15:30:00 | | 159 | 3 | Student 3 | 2014-01-17 08:35:00 | 2014-01-17 15:30:00 | | 160 | 4 | Student 4 | 2014-01-17 08:21:00 | 2014-01-17 15:30:00 | | 161 | 4 | Student 4 | 2014-01-17 08:21:00 | 2014-01-17 15:30:00 | | 162 | 4 | Student 4 | 2014-01-17 08:21:00 | 2014-01-17 15:30:00 | | 163 | 6 | Student 6 | 2014-01-17 08:27:00 | 2014-01-17 15:30:00 | | 164 | 6 | Student 6 | 2014-01-17 08:27:00 | 2014-01-17 15:30:00 | | 165 | 7 | Student 7 | 2014-01-17 08:30:00 | 2014-01-17 15:30:00 | | 166 | 7 | Student 7 | 2014-01-17 08:30:00 | 2014-01-17 15:30:00 | | 167 | 7 | Student 7 | 2014-01-17 08:30:00 | 2014-01-17 15:30:00 | | 168 | 8 | Student 8 | 2014-01-17 08:39:00 | 2014-01-17 15:30:00 | | 169 | 9 | Student 9 | 2014-01-17 08:41:00 | 2014-01-17 15:30:00 | | 170 | 9 | Student 9 | 2014-01-17 08:41:00 | 2014-01-17 15:30:00 | | 171 | 9 | Student 9 | 2014-01-17 08:41:00 | 2014-01-17 15:30:00 | | 172 | 10 | Student 10 | 2014-01-17 08:19:00 | 2014-01-17 15:30:00 | | 173 | 10 | Student 10 | 2014-01-17 08:19:00 | 2014-01-17 15:30:00 | | 174 | 10 | Student 10 | 2014-01-17 08:19:00 | 2014-01-17 15:30:00 | | 175 | 1 | Student 1 | 2014-01-20 08:15:00 | 2014-01-20 15:30:00 | | 176 | 2 | Student 2 | 2014-01-20 08:29:00 | 2014-01-20 15:30:00 | | 177 | 3 | Student 3 | 2014-01-20 08:15:00 | 2014-01-20 15:30:00 | | 178 | 4 | Student 4 | 2014-01-20 08:42:00 | 2014-01-20 15:30:00 | | 179 | 4 | Student 4 | 2014-01-20 08:42:00 | 2014-01-20 15:30:00 | | 180 | 5 | Student 5 | 2014-01-20 08:32:00 | 2014-01-20 15:30:00 | | 181 | 5 | Student 5 | 2014-01-20 08:32:00 | 2014-01-20 15:30:00 | | 182 | 6 | Student 6 | 2014-01-20 08:36:00 | 2014-01-20 15:30:00 | | 183 | 6 | Student 6 | 2014-01-20 08:36:00 | 2014-01-20 15:30:00 | | 184 | 7 | Student 7 | 2014-01-20 08:42:00 | 2014-01-20 15:30:00 | | 185 | 7 | Student 7 | 2014-01-20 08:42:00 | 2014-01-20 15:30:00 | | 186 | 9 | Student 9 | 2014-01-20 08:37:00 | 2014-01-20 15:30:00 | | 187 | 9 | Student 9 | 2014-01-20 08:37:00 | 2014-01-20 15:30:00 | | 188 | 10 | Student 10 | 2014-01-20 08:26:00 | 2014-01-20 15:30:00 | +-----+------------+--------------+---------------------+---------------------+ My code <?php $db = new mysqli(HOST,USERNAME,PASSWORD,'monty'); $monday = '2014-01-06'; // week commencing date $dt = new DateTime($monday); $dp = new DatePeriod($dt, new DateInterval('P1D'), 4); // // table headings // $heads = "<tr><th class='name'>Student Name</th>"; foreach ($dp as $d) { $datesArray[$d->format('Y-m-d')] = ''; // create empty array $heads .= '<th>' . $d->format('D jS') . '</th>'; } $heads .= "</tr>\n"; // // table data // $sql = "SELECT DISTINCT student_id , student_name , DATE(swipe_in) FROM attendance WHERE DATE(swipe_in) BETWEEN '$monday' AND '$monday' + INTERVAL 4 DAY ORDER BY student_id"; $curname = $curid = ''; $tdata = ''; $res = $db->query($sql); while (list($id, $name, $date) = $res->fetch_row()) { // check if student has changed if ($id != $curid) { if ($curid) { // output row for the current student $tdata .= "<tr><td class='name'>$curname</td><td>".join('</td><td>', $studentData)."</td></tr>\n"; } $curname = $name; // reset name and id $curid = $id; $studentData = $datesArray; // reset empty array ready for next student } $studentData[$date] = '✓'; // flag student as attended } $tdata .= "<tr><td class='name'>$curname</td><td>".join('</td><td>', $studentData)."</td></tr>\n"; ?> <html> <head> <style type="text/css"> td,th { padding: 4px; } td { font-family: sans-serif; font-size: 9pt; text-align: center; } .name { text-align: left; width: 200px; } table { border-collapse: collapse; } </style> </head> <body> <h4>Week Commencing <?php echo $dt->format('l, jS F, Y'); ?></h4> <table border='1'> <?php echo $heads, $tdata ; ?> </table> </body> </html> Results attached Quote Link to comment https://forums.phpfreaks.com/topic/285829-select-unique-records-aggregating-on-a-date-in-datetime-format/#findComment-1467237 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.