我有两个相同的查询
查询1:
AA
AE
AH
AO
AW
AY
B
CH
D
EH
ER
EY
F
G
HH
IH
IY
JH
K
L
M
N
<oov>
OW
P
R
S
T
TH
UW
V
W
Y
Z
查询2:
$request1 = $bdd->prepare('SELECT * from table1, table2 where table1.FK_license = table2.license and date = (select max(date) from table1 where user = :user)');
$request1-> execute(array(
':user' => $id
));
但我需要第一个查询来制作这样的循环:
$request2 = $bdd->prepare('SELECT * from table1, table2 where table1.FK_license = table2.license and date = (select max(date) from table1 where user = :user)');
$request2-> execute(array(
':user' => $id
));
$test = $request2->fetch();
第二个请求只检索某行共有的数据
<?php foreach ($request1 as $value) { ?>
<tr>
<td><?php echo $value['li']; ?></td>
<td><?php echo $value['cu']; ?></td>
<td><?php echo $value['qt']; ?></td>
<td><?php echo $value['pk']; ?></td>
</tr>
<?php } ?>
我如何只使用一个查询来做同样的事情?因为当我获取第一个请求时,我无法在
之后执行操作谢谢
编辑:最终代码如
$test['data_for_group_by']