Good morning, I hope you can help me with this query, I have this query:
SELECT at_ce.condicion, COUNT(*) AS cantidad
FROM at_cons_externa at_ce
GROUP BY at_ce.condicion
And as a result it gives me this:
What I need is to create ONE SINGLE query that adds "CONFIRMED" + "OBSERVED" from the condition field and another one that adds "I DID NOT PASS QUERY" + "CONFIRMED" + "OBSERVED". I hope someone can help me or guide me. Maybe an "if" or related can be handled inside.
Thank you...
Without taking into account optimizations and assuming that they are small tables...:
The tables that start with
#
are tables that are created at the moment (temporary) but it is important to make adrop table
at the end to be able to reuse them.I like to use temporary tables, but if you want to do it in a single query...:
With UNION :
Hello, I'm going to recommend you something better, download a program called SQLyog Enterprise, connect your mysql to the program and generate a query builder, you just have to drag and drop, selecting the table and the values you want and it only generates the query, copy it and paste it in your page and done. see an example in the photo