What i try to do is, counting my rows in this SQL statement, as well as want to retrieve the data into the Repeater. This is ASP.NET / C#.
SELECT COUNT(*) AS 'numbersOfOrdres'
FROM customers
INNER JOIN orders ON customers.customer_id = orders.order_customer_id
Doesn’t seems to work, i’ll keep getting the error "Does not contain 'THEN MY FIELD NAME' in the Repeater.
EDIT:
Repeater code
<asp:Repeater ID="customerOrdersRepeater" runat="server">
<HeaderTemplate>
<table>
<tr>
<td><b>Customer name</b></td><td><b>Customer adresse</b></td><td>Numbers of orders</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Eval("customer_name") %></td><td><%# Eval("customer_adresse") %></td><td><%# Eval("numbersOfOrdres") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
You would need to aggregate your results using
GROUP BY. It looks like you want a row per unique customer/customer address. So assuming these are held incustomers.nameandcustomers.adresseyour query would be