1
If you’re wondering how many orders were placed by each restaurant, you can use one GROUP BY
to tell:
SELECT
idrestaurantepedido,
count(distinct idpedido) as qtd_pedidos
FROM pedidos
GROUP BY idrestaurantepedido
1
2
If you’re wondering how many orders were placed by each restaurant, you can use one GROUP BY
to tell:
SELECT
idrestaurantepedido,
count(distinct idpedido) as qtd_pedidos
FROM pedidos
GROUP BY idrestaurantepedido
Browser other questions tagged sql sql-server query mysqli phpmyadmin
You are not signed in. Login or sign up in order to post.
But only with what you’ve shown you can register more than one restaurant per order (assuming that each order and restaurant are the primary keys to your respective tables)?
– anonimo