1
クエリの作成に問題があります。私はUNIONとの2つのクエリで作業しており、うまく動作します。 2つのクエリの結果を追加しようとすると、私の問題が発生します。Mysqlで2つの異なるクエリの結果を追加する
ここは自分自身を説明するものです。
//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