MySQL has a function to return a value if the result is null. You can use it on a whole query:
SELECT IFNULL( (SELECT field1 FROM table WHERE id = 123 LIMIT 1) ,'not found');
More Related Contents:
- NOT LIKE not working with SHOW [duplicate]
- MySQL Error 1093 – Can’t specify target table for update in FROM clause
- MySQL – Rows to Columns
- ROW_NUMBER() in MySQL
- How to define a custom ORDER BY order in mySQL
- How can I temporarily disable a foreign key constraint in MySQL?
- Comparison of full text search engine – Lucene, Sphinx, Postgresql, MySQL? [closed]
- How to get the number of days of difference between two dates on MySQL?
- MySQL Error 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes
- conditional join in mysql
- MYSQL Select MAX Date inside a join statement
- How to grant all privileges to root user in MySQL 8.0
- MySQL Group by SUM
- TRIGGERs that cause INSERTs to fail? Possible?
- Mysql query to dynamically convert rows to columns on the basis of two columns
- Search for all occurrences of a string in a mysql database [duplicate]
- Count days between two dates, excluding weekends (MySQL only)
- MySQL: How do I join same table multiple times?
- Difference in minutes from two time fields in MySQL
- error code 1292 incorrect date value mysql
- NodeJS responded MySQL timezone is different when I fetch directly from MySQL
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ [duplicate]
- How to swap values of two rows in MySQL without violating unique constraint?
- SQL date format convert? [dd.mm.yy to YYYY-MM-DD]
- Would it help to add index to BIGINT column in MySQL?
- ALTER TABLE ADD COLUMN takes a long time
- Creating MYSQL Procedure in Laravel 4 Migrations
- MySQL: Computed Column
- Mysql server does not support 4-byte encoded utf8 characters
- Default sort-ordering in MySQL (ALTER TABLE … ORDER BY …;)