1
쿼리를 작성하는 데 문제가 있습니다. 두 쿼리에 대한 UNION 작업을 해왔으며 잘 작동합니다. 두 가지 쿼리 결과를 추가하려고하면 문제가 발생합니다.MySQL에서 두 가지 다른 쿼리 결과 추가
다음은 나 자신을 설명하는 것입니다. 나는이 쿼리를 실행하면
//Query 1
select count(id) from table1 <-- This gives a result of 2
//Query 2
select count(id) from table2 <-- This gives a result of 1
//What I want to do is to add the two queries (2 + 1 = 3):
(select count(id) from table1) + (select count(id) from table2) <-- Which gives a result of 3.
이 오류가 나타납니다
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+
나는 내가 "+"기호를 사용하지한다고 생각합니다. 이 일을 할 수있는 방법이 있습니까? 정말 고마워요!
감사를보십시오, 지금은 아주 잘 작동 – mauguerra