我在下面的UNION查询完美无缺。 来自UNION查询的数据显示在网格中。 我还有一个ITERATIVE add 查询,允许用户添加多个记录。 自从我创建了UNION查询 ADD查询不再有效。 如何在UNION之后完成添加(迭代)? 两个查询都在下面。
UNION QUERY
SELECT
submissions.user, submissions.statusid, submissions.no, submissions.Name,
submissions.monthid, submissions.yearid, submissions.dateupdated
FROM submissions
RIGHT OUTER JOIN name ON submissions.no = name.no
WHERE submissions = SELECT DISTINCT CONCAT(status),statusid
FROM status WHERE statusid = 1 ORDER BY status
AND submissions.monthid = SELECT DISTINCT CONCAT(month),monthid
FROM month ORDER BY monthid
AND submissions.yearid = SELECT year FROM year ORDER BY Yearid
UNION
SELECT
name.user, name.statusid, name.no, name.Name, name.area,
name.monthid, name.yearid, name.dateupdated
FROM name
LEFT OUTER JOIN submissions ON name.no = submissions.no
添加查询(ITERATIVE)
/* Set the Status ID */
SET @statusid = submissions.statusid
/* Set the Month ID */
SET @monthid = submissions.monthid
/* Set the Month ID */
SET @yearid = submissions.yearid
/* Set the User ID */
SET @user = <code type="user" attribute="id" />
/* Set the Date Updated */
SET @dateupdated = NOW()
/* Insert records iteratively */
/* @user, @statusid, no, name, area, @monthid, @yearid,
@dateupdated */
INSERT INTO submissions
SELECT @user, @statusid, s.no, s.name, s.area, @monthid, @yearid,
@dateupdated
FROM school_submissions s
添加查询不断给我以下错误:&#34;没有输入&#39; no&#39;&#34;。 它基本上不会“捡起来”。 &#39; no&#39;从网格, 因此它无法将记录插入表中。 自UNION查询以来 ADD查询无法找到每个No,Name和Area。
我怎样才能解决这个问题?