-1
Good afternoon, everyone.
When developing for VB I used a select using top, to select certain line I wanted, but I am developing in php now and I am using phpmyadmin BD and would like if possible as I do to select only one line, because I will use a loop in php to read line by line.
I have tested the limit but it shows all within the limit, and I need the select to select only one line.
I tested some select that staff commented on various websites but unsuccessfully.
the last one I used now was the:
`SELECT cdAgendamento FROM agendamento WHERE cdAgendamento > 10 AND ROWNUM = 1`
Grateful!
can limit select results using limit.
– Luís Almeida
Your question is confusing. You say q wants to select only one row in select. "SELECT * FROM table limit 1"; does this. But then you say you want to do a for in PHP to go reading line by line. You want to bring one or more Mysql results?
– alan
I test first in select because I want to read line by line.
– Mitnick
For example, I need to read line 1 to 5, one at a time and if in select it brings one at a time as I want later in php I do the loop that reads one at a time.
– Mitnick
@Anderson M. Your comments are still confusing to me. Let’s see if I understand. You want to select from 5 records and then do a for in PHP to read these records?
– alan
I want to simply select a specific line, for example I have 10 records, and I want only record 7, so I wanted to know how to do, in SQL server I used the top q after q vc uses Count to have the amount of rows I select the one I want by the number understood.
– Mitnick
Take a look at this solution: http://www.devmedia.com.br/forum/obterequivalente-ao-rownum-do-oracle-para-o-mysql/30959
– Hugo Leonardo