Angelo Teixeira
Angelo Teixeira

Reputation: 21

mysql query returning NULL for one column values

I have a mysql database where I want to search for rows that satisfy a certain condition. For that, I'm using the LIKE command, until here, all fine. However, there's a column that is showing its rows values as NULL. This only happens when I SELECT 3 of the 3 float column values. Below I leave pictures of the queries and the shown results.

CODE:

SELECT `id`, `name`, `priceDose`, `priceHalfDose`, `priceQuarterDose` FROM `weekendmeals` WHERE `name` LIKE "%porco%"

RESULT:

=================================================================
| id | name                 | priceDose | priceHalfDose |       |
-----------------------------------------------------------------
| 45 | Entrecosto de Porco  |      9.20 |          4.80 | NULL  |   
| 46 | Costelinhas de Porco |     12.30 |          6.90 | NULL  |
| 50 | Costelinhas de Porco |     12.30 |          6.90 | NULL  |
=================================================================

Picture showing the bug

CODE:

 SELECT `id`, `name`, `priceDose`, `priceQuarterDose` 
 FROM `weekendmeals` 
 WHERE `name` LIKE "%porco%"

RESULT:

============================================================
| id | name                 | priceDose | priceQuarterDose |
------------------------------------------------------------
| 45 | Entrecosto de Porco  |      9.20 |          0.00    |   
| 46 | Costelinhas de Porco |     12.30 |          0.00    |
| 50 | Costelinhas de Porco |     12.30 |          0.00    |
============================================================

Result when I remove one of the -float values- column from the search query

As you can see, the results are correctly shown when there are only 1 or 2 float columns in the search query, but when I SELECT all the 3 necessary columns of float values, one of them doesn't show, and the values of the rows are NULL.

Thanks in advance for any help. If you need extra explanation/data feel free to ask :)

Upvotes: 0

Views: 1334

Answers (1)

Angelo Teixeira
Angelo Teixeira

Reputation: 21

After all it was just a phpmyadmin bug, read the question's comments for more info.

Upvotes: 1

Related Questions