-1

Hey, I am having a really stupid yet annoying problem.

I have a simple database stracture (I'll give an example below) and I want to do a query that will loop through it's elements trying to display the list amount of times each element (trying to make it the most unique it can).


Example for the database:

field 1 | field 2
-------------------
| A_name | A_meow |
-------------------
| A_name | mrgao |
-------------------
| esea | fafas |
-------------------
| A_name | mrewo |
-------------------
| esea | wahod |
-------------------

I want to do a query that will look something like this (it's not real query)
SELECT * FROM `table` LOOP `field 1` LIMIT 4
and the output would be like this:
-------------------
| A_name | A_meow |
-------------------
| esea | fafas |
-------------------
| A_name | mrgao |
-------------------
| esea | wahod |
-------------------

notice how it looped through the field 1 but not the others, that's what I wanna do but I can't figure how!!!!!!!

the closest thing I can do is SELECT DISTINCT(`field 1`), * FROM `table` LIMIT 4
but than I will not recive 4 results like I want, I will recive the amount of distincted field 1 values.

I hope I didn't complex you with the way I asked it but it would really help me if you find a way to do it!

Thanks, Omri.

2
Contributors
1
Reply
3
Views
12 Years
Discussion Span
Last Post by Chagh
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.