I am trying to do something like this:
select * from receipt where branch=:branch AND distinct transactionid
However this is not working and brings up all results. I just need to get all the information that matches what I need and has a distinct transaction. So that might include firstname lastname and all the information that each listing in the database stores as I use all that information later.
Lets say I have:
+--------+-----------+----------+-----------------+
| first | last | item | transactionid |
+--------+-----------+----------+-----------------+
| jack | sparrow | water | 1234 |
| jack | sparrow | food | 1234 |
| jack | sparrow | wood | 1234 |
+--------+-----------+----------+-----------------+
I want all listings with the first name jack (any one of them) with a distinct transactionid…
Can this even be done?
try this one,
Thanks for the edit zerkms
so what does the subquery do?
Well, it just gets one item per
transactionID. You can also useMAXon it.