You can use IF()
where in Oracle you would have used DECODE()
.
mysql> select if(emp_id=1,'X','Y') as test, emp_id from emps;
Related Posts:
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- ORA-00904: invalid identifier
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- Case statement in MySQL
- Error Code: 2013. Lost connection to MySQL server during query
- how to drop partition without dropping data in MySQL?
- What is it exactly a BLOB in a DBMS context
- How do I reset a sequence in Oracle?
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- Self Join to get employee manager name
- how to fix oracle ORA-01722 invalid number error
- MySQL – Operand should contain 1 column(s)
- MySQL “CREATE TABLE IF NOT EXISTS” -> Error 1050
- ORA-00979 not a group by expression
- How do I use properly CASE..WHEN in MySQL
- How can I do a FULL OUTER JOIN in MySQL?
- MySQL query String contains
- How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
- MySQL Cannot Add Foreign Key Constraint
- How do I restore a dump file from mysqldump?
- ORA-00918: column ambiguously defined in SELECT *
- Oracle error : ORA-00905: Missing keyword
- How to split the name string in mysql?
- What does SQL Select symbol || mean?
- How do I import an SQL file using the command line in MySQL?
- mysql Foreign key constraint is incorrectly formed error
- How do I limit the number of rows returned by an Oracle query after ordering?
- MySQL: Invalid use of group function
- Can a foreign key be NULL and/or duplicate?
- Compare dates in MySQL
- MySQL “WITH” clause
- What is the difference between JOIN and UNION?
- MySQL Multiple Joins in one query?
- ORA-00972 identifier is too long alias column name
- PLS-00103: Encountered the symbol when expecting one of the following:
- What’s the difference between RANK() and DENSE_RANK() functions in oracle?
- ORA-00918: column ambiguously defined in SELECT *
- ORA-00918: column ambiguously defined in SELECT *
- 1052: Column ‘id’ in field list is ambiguous
- 1052: Column ‘id’ in field list is ambiguous
- Oracle – ORA-01489: result of string concatenation is too long [duplicate]
- “ORA-01438: value larger than specified precision allowed for this column” when inserting 3
- MySQL Error 1264: out of range value for column
- How do you create a temporary table in an Oracle database?
- Oracle “Partition By” Keyword
- Oracle SQL: Update a table with data from another table
- Oracle SQL query for Date format
- How to SUM and SUBTRACT using SQL?
- The backend version is not supported to design database diagrams or tables
- Create mysql table directly from CSV file using the CSV Storage engine?
- Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL?
- SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax — PHP — PDO [duplicate]
- SQL selecting rows by most recent date with two unique columns
- How do you force mysql LIKE to be case sensitive?
- Postgres Error: More than one row returned by a subquery used as an expression
- ERROR 1148: The used command is not allowed with this MySQL version
- Comparing Dates in Oracle SQL
- MySQL starts with searching issue
- Is it possible to GROUP BY multiple columns using MySQL?
- Update statement with inner join on Oracle
- Best way to test if a row exists in a MySQL table
- The used SELECT statements have a different number of columns
- MySQL: Can’t create table (errno: 150)
- Join vs. sub-query
- Alternative to except in MySQL
- Oracle: If Table Exists
- DATEDIFF function in Oracle
- Equivalent of explode() to work with strings in MySQL
- How to do a batch insert in MySQL
- How to create id with AUTO_INCREMENT on Oracle?
- LEFT function in Oracle
- Solutions for INSERT OR UPDATE on SQL Server
- MySQL – Get row number on select
- MySQL error: Unknown column in ‘where clause’
- What is the difference between Views and Materialized Views in Oracle?
- How to truncate the text returned for a column in a MySQL query
- “select * into table” Will it work for inserting data into existing table
- Using union and order by clause in mysql
- ORA-01735: invalid ALTER TABLE option – Toad
- How to execute mulitple statement SQL queries using $wpdb->query?
- Size article thumbnails and retrieve them directly from database
- wpdb_prepare with multiple or condition
- How do I find which articles are missing a featured image in The WordPress database?
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- How do I get the posts within a certain year/date(with sql query)?
- Create table from array with prepare
- Migrating to WordPress Recipe Plugin and Some SQL Issues
- Using AND and bracket grouping in SQL not working
- SQL query to set posts in bulk based on the post content
- WP MultiSite: Can’t select database error after changing to new domain
- $wpdb->get_var – What value is returned when zero records are found?
- DB prefix not updating
- Performing CRUD operations on front end in wordpress
- How to create index (sql) to a meta_key?
- The function is deprecated; use mysql_real_escape_string() instead
- can’t delete a row from post_meta table
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- export individual posts to text files or a single csv file