What query command will do this?

In my database, I have this table:


----------------------------------------------------
| id |     invoicenumber     |    productnumber    |
----------------------------------------------------
| 1  |           1           |          45         |
| 2  |           1           |          53         |
| 3  |           1           |          25         |
| 4  |           2           |          12         |
| 5  |           2           |          32         |
| 6  |           2           |          73         |
| 7  |           2           |          99         |
| 8  |           3           |          10         |
| 9  |           3           |          11         |
----------------------------------------------------

The goal of my page is to display a list of links to each individual invoice:

Invoice 1
Invoice 2
Invoice 3

What MySQL query will perform this task?

Thanks
Regards

Sorry, I dont understand your question. Could you explain what you’re trying to do a bit better?

Basically I’m trying to find a query command like:


$query= "SELECT * FROM table WHERE (--------------------)";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
$invoicenumber = $row['invoicenumber'];
echo "Invoice ".$invoicenumber.";
}

I want the end result to just be a list of the invoices in my table above:

Invoice 1
Invoice 2
Invoice 3

I’m thinking this should be really simple but I don’t how to select unique invoice numbers.

SELECT DISTINCT invoicenumber FROM daTable

:slight_smile:

Awesome! Thanks a lot, this is exactly what I was looking for. :slight_smile:

Best Regards