I need to do a search that specifies in witch line of the search that the information was found. For example:

select * from table where height=100;

this code returns 50 lines, but i want, for example, in that search, the person 'Matheus' was in the 28th line of the search above

3 Years
Discussion Span
Last Post by pritaeas

If you want specific data...

select * from table where height=100 LIMIT 27,1;

Will give you just the 28th record for a record with height set to 100.

usually,m you wouldn't know which limit offset to use, so you could do this...

select * from table where height=100 AND firstname='Matheus' LIMIT 1;

That would give you the first hit for a record having height set to 100 AND a firstname of 'Matheus'. If you have multiple recults and want the last one only...

select * from table where height=100 AND firstname='Matheus' ORDER BY id DESC LIMIT 1;

Assuming that you have a PK autoinc field called 'id'


But I dont know that Matheus is the 28th name of the select statement, but I want to know. For example:

the following table 'persons':

name height
Jean 100
Matheus 98
Joseph 99
Mary 95

and the select:

select * from persons where ?????????;

and returns:

Matheus was in the 2nd line

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.