Posts by Guilherme Torres • 19 points
2 posts
-
-1
votes3
answers2032
viewsA: Select from the last records sorted by 1 field
Is the ID sequential and the date growing? If it is, you could get the last id - 3. Select * from TB where id >= (Select max(id) from TB) - 3 order by Nome
-
2
votes4
answers1630
viewsA: Validate, if already exists does not INSERT
Another solution for not having to make two requests in the bank is to make one Insert with select: INSERT INTO favoritos (id_user, id_oferta) SELECT ('$login_session', '$id') WHERE NOT EXISTS(…
phpanswered Guilherme Torres 19