第一个查询为我提供了必填字段(klass
,Liikmenimi
,synniaeg
,Tiim
等。
query("
SELECT klass, nimi, synd, teamnimi, start, TIME(`finish`) AS finish FROM bc2014 T1
INNER JOIN bc2014aeg T2 on T1.bc2014_id = T2.bc2014_id
WHERE klass = 'DS1 (1 koera toukerattavedu al.14 a.)' ");
在phpMyAdmin中:
select timediff(time(finish), time(start)) AS aeg FROM bc2014aeg
在表格中给出了“时间”所需的结果
我如何合并这两个 - 在我的情况下?
答案 0 :(得分:0)
MySQL UNION运算符允许您将多个表中的两个或多个结果集合并到一个结果集中。 MySQL UNION的语法如下:
SELECT column1, column2
UNION [DISTINCT | ALL]
SELECT column1, column2
UNION [DISTINCT | ALL]
…
答案 1 :(得分:0)
您应该只能将字段添加到语句的选择部分
query("
SELECT
klass, nimi, synd, teamnimi, start,
TIME(`finish`) AS finish,
timediff(time(finish), time(start)) AS aeg
FROM bc2014 T1
INNER JOIN bc2014aeg T2 on T1.bc2014_id = T2.bc2014_id
WHERE klass = 'DS1 (1 koera toukerattavedu al.14 a.)'
");