結合したい 2 つの個別のクエリがあります。
SELECT e.id, e.measurement, e.name, weight, time, reps, distance, exerciseid, DATE(date) as date
FROM `users exercises` LEFT JOIN exercises as e ON e.id = exerciseid
WHERE `userid` = '24' AND `date` < now()
ORDER BY date DESC LIMIT 100
SELECT f.id, f.name, f.calories, f.protein, f.carbohydrate, DATE(date) as date, value, meal, unit
FROM `users foods` LEFT JOIN foods as f ON f.id = foodid
WHERE `userid` = '24' AND `date` < now()
ORDER BY date desc LIMIT 100
出力:
Array
(
[id] => 489
[measurement] => 2
[name] => Dumbbell Stability Ball Press
[weight] => 20
[time] =>
[reps] => 20
[distance] =>
[exerciseid] => 489
[date] => 2013-08-01
)
Array
(
[id] => 7
[name] => Cheese, camembert
[calories] => 300
[protein] => 19.8
[carbohydrate] => 0.46
[date] => 2013-09-20
[value] => 23
[meal] => 3
[unit] => 2
)
同じ出力を維持しながらこれらを組み合わせることは可能ですか?
編集:申し訳ありませんが、明確ではありませんでした。私はこれらのクエリを結合したくありません。私はこの後ではありません:
Array
(
[id] => 672
[measurement] => 1
[name] => Ab Wheel (standing)
[weight] =>
[time] =>
[reps] => 5
[distance] =>
[exerciseid] => 672
[fid] => 23
[fname] => Cheese, gruyere
[calories] => 413
[protein] => 29.81
[carbohydrate] => 0.36
[value] => 54
[meal] => 1
[unit] =>
)
配列を元の配列と同じに保ちたいのですが、2 つのクエリを使用する代わりに、1 つだけを使用したいと考えています。もし可能なら。