-3
我表演有一些语法错误,下面的查询:什么将正确的MySql查询?
SELECT count (tbl_staff.staff_id as staff_number),SELECT count (tbl_client.client_id as client_number),SELECT count (tbl_appointment.appt_id as appt_number),SELECT count (tbl_subscription.subscription_id as subscription_number)
FROM tbl_subscription
LEFT JOIN tbl_staff
ON (
tbl_staff.merchant_id = tbl_subscription.merchant_id)
LEFT JOIN tbl_appointment
ON (
tbl_appointment.merchant_id = tbl_subscription.merchant_id)
LEFT JOIN tbl_client
ON (
tbl_client.merchant_id = tbl_subscription.merchant_id)
WHERE tbl_subscription.subscription_id=1;
我想获得staff_id,client_d的计数,appointment_id上特别Subscription_id。
1.你不告诉我们该错误信息是什么2.你不能在一两个SELECT语句查询 –
1.删除除第一个外的所有“SELECT”关键字。 (您有四个)。2.将所有'as'部分移到右括号的外部,如'count(tbl_subscription.subscriptionid)as subscription_number'。 3.找到一个SQL教程并做一些阅读。 4.立即学习,当你写*错误时*你需要**特定**关于错误,包括提供你得到的确切的错误信息。 A **语法错误**包括一个文本错误,其中包含有关错误位置的信息。也包括我们的消息。 –
@JohnConde我已经提到我有语法错误,我不知道在哪里以及如何从不同的表格列中统计并生成一张表格 – Ameen