4
I have the following task:
Make a query where I have to give preference to the word passed as parameter.
I search two fields with one OR
, but I need to prioritize the consultation by the first field.
For example: if I search for "%physica%", currently brings the word physica in the two fields, but the most important is the first field, because as I am doing a OR
, in the first column displaying the result appears physical at the beginning and comes a lot of other results, and then more "physical", "physical education".
I don’t know if I explained it right, but I hope someone has an idea to fix it, I’ve looked like crazy.
I didn’t get it. It wouldn’t just be searching using
WHERE campo = 'fisica'
?– Rodrigo Rigotti
Have part of your SQL? Edit for us analyze, put examples.
– lionbtt
your database is the
mysql
or thesql server
?– rray
You want to do an exact search and, if you don’t find anything, a rough search. Is that it? Don’t see a way to do this in just one step.
– Edgar Muniz Berlinck
@Edgarmunizberlinck if that’s what he could work with
UNION
.– Rodrigo Rigotti
@rodrigorigotti could, but so far I have not quite understood what he wants. If it is only for the sake of ordination he can make a exact search Union approximate search - exact search
– Edgar Muniz Berlinck
Remember to choose the best answer. You ask a lot of questions and those who answer like to get feedback as well. Hug.
– thiagobarradas