Hello!
I have a table with the structure you can check at http://spreadsheets.google.com/ccc?key=0Ahb705_66NMOdG5RM0stQU5wVC1JUmRBbWhLeDRyM2c&hl=ca. The table has many more rows but no more columns. Is there a way to select the rows like select all the fields from Table from row where Family is Tinamidae to the next non empty row ? In this example, I would like to select all the fields between the rows where Family is Tinamidae and Struthionidae.
Cheers!

Dani

If I have understood this correct, you want to select all rows that come under 'Tinamidae'?

Firstly I would structure the data so that all rows have an entry within the Family column. This means repeating the term 'Tinamidae' for all the members of that family within the family column. Then you would select them with the statement.

SELECT * FROM `table_name` WHERE `Family` = 'Tinamidae';

I'm not sure if I haven understood you correctly. I'm no expert on SQL either.

Hope this helps.

Danny

Now, it just selects one row. If you check the table in the link, you'l see that between the Tinamidae and the next non empty field there are some empty fields. Well, I would like to select all the fields of the record between the Tinamidae and the next non empty field specifying only the first record (Tinamidae, in this case).
Cheers!

Dani

I don't believe the table you have shown is structured like data in a MySQL table should be.

Something like this would allow you easy access to the information you are after, with the select statement I gave you.

[U]Family	        Genus	  Species	English name[/U]
		
Tinamidae	Tinamus	  tao	        Grey Tinamou
Tinamidae	Tinamus	  solitarius    Solitary Tinamou
Tinamidae	Tinamus	  osgoodi	Black Tinamou
Tinamidae	Tinamus	  major	        Great Tinamou

Otherwise I don't think there is a way to identify the entries your after. At least not that I can fathom.

Hope this helps.

Cheers.

Danny

I'm afraid so. The problem is that I am working with a csv file that has this structure. I guess I'll have to format it.
Cheers!
Dani

No Problem, Good luck!

Danny

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.