This is my code that makes a table listing
<?php
$consulta = mysql_query("SELECT * FROM mesas INNER JOIN pedidos WHERE pedidos.mesa = mesas.id and conta = 0");
if (mysql_num_rows($consulta)==true) {
while($lnmesas = mysql_fetch_array($consulta)){
?>
I put a request in the database and it inserts it with the name, size, value, produced = 0, account = 0, and the table number, so I made this inner join there because I just want it to display the table that contains a record in the database that the table column is = the table number in the table tables ...
But for example I launch two orders with the number of table 20 Then he shows me twice the table 20 if I post 4 orders on the table 15 he displays to me 4 times the table 15, and I wanted him to display only one of each.
I created SQL Fiddle to improve the explanation of the problem.