Good afternoon,
I have the following table ..
*eventos*
----------------------------------------
| id_evento | id_projeto | nome_evento |
----------------------------------------
I need to do a procedure as follows:
"Select events where the project_id is 1 with a 2-record limit, but if the number of records is less than 2, select the last events logged to complete the total amount of 2 records. "
I need to select the records that have givenid_projeto
but if by chance there is no record (with this id) I need to select the last two of the events table, and if there is only 1 then I need to select only 1 record.
I hope I have been clear. Any questions I answer.
obs: I'm using the mysql database