Every derived table (AKA sub-query) must indeed have an alias. I.e. each query in brackets must be given an alias (AS whatever
), which can the be used to refer to it in the rest of the outer query.
SELECT ID FROM ( SELECT ID, msisdn FROM ( SELECT * FROM TT2 ) AS T ) AS T
In your case, of course, the entire query could be replaced with:
SELECT ID FROM TT2
Related Posts:
- MySQL Error 1093 – Can’t specify target table for update in FROM clause
- MySQL Error 1093 – Can’t specify target table for update in FROM clause
- Join vs. sub-query
- Access Denied for User ‘root’@’localhost’ (using password: YES) – No Privileges?
- Fatal error: Call to undefined function mysql_connect()
- How can I fix MySQL error #1064?
- Mysql: Setup the format of DATETIME to ‘DD-MM-YYYY HH:MM:SS’ when creating a table
- MySQL DROP all tables, ignoring foreign keys
- Access Denied for User ‘root’@’localhost’ (using password: YES) – No Privileges?
- ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)
- mysql is not recognised as an internal or external command,operable program or batch
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
- java.sql.SQLException: Access denied for user ‘root’@’localhost’ (using password: YES)
- ERROR 1452: Cannot add or update a child row: a foreign key constraint fails
- Data truncated for column?
- Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
- MySQL date format DD/MM/YYYY select query?
- How to escape apostrophe (‘) in MySql?
- Error: select command denied to user ‘
‘@’ ‘ for table ‘ ‘ - The used SELECT statements have a different number of columns
- #1214 – The used table type doesn’t support FULLTEXT indexes
- Equivalent of explode() to work with strings in MySQL
- MySQL Error 1215: Cannot add foreign key constraint
- How to use the keyword ‘references’ in MySQL?
- The MySQL alternatives: Do Percona Server and MariaDB work well with WordPress, and do they make WordPress go better?
- What are the recommended database permissions for WordPress?
- How can I find the source of slow queries in WordPress?
- Resetting comment count
- $wpdb and MySQL Create Trigger
- Changing user_nicename
- importing data from non-wordpress mysql db
- Fulltext search in posts sorted by relevancy
- How to Remove Two (Related) wp_postmeta Rows?
- wp_insert_user is not working for me?
- Query All users that has post
- Split a database will improve performance?
- Sortable admin column for one meta key with three possible meta values
- Can’t publish new posts
- WordPress Ajax Custom Query – High CPU LOAD
- AJAX in WordPress, sending coords data to MySQL and show after into map
- Migrating database / content of non-CMS site to WordPress
- wordpress in nginx docker container connected to php:8-fpm container and mariadb container isn’t creating any tables on plugin activation
- How to Query Database for posts with certain Taxonomy Term
- Error while importing database
- Deleting Custom Post type data using mySQL command
- Is there a way to get 3+ dimensional array from a single MySql command
- Importing Geo data into wordpress database
- Can I restart MySQL engine when WordPress website is live?
- Why my wordpress loopback traffic while socket is setup?
- How to remove /year/month from uploaded medias?
- SQL to order by CPT results by user->display_name w/only user->ID known
- wpdb custom tables without plugin
- new multisite, old db
- Call to undefined function get_user_meta() – trying to access data in MySQL from custom fields
- Update or insert meta key value – On Duplicate key update
- Connect to MySQL using Windows Authentication
- Speeding SQL queries for a large database?
- Have working sql query… trying to adjust it to use $wpdb
- how update data through ajax and jquery
- php include not working in custom page
- How to get INSERT errors from $wpdb?
- Delete all user’s meta without knowing all the ‘key’
- Export Yoast Keywords from MySQL/phpMyAdmin
- Same database; different WordPress
- How can I programmatically change a MySql variable (foreign_keys_check)?
- add category to posts with tag wordpress
- How can I Use 2 databases with one WordPress install
- Why won’t this wpdb get_results query return results?
- How to select particular month post from table and update the post status using MySQL?
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- Sql query does not work well
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- How to Get Last ID?
- AWS Lightsail WordPress – connect to database on instance using mysqli
- Get All Results From Other Users That Share The Same Custom User Meta As Current User
- call to undefined function mysql_connect
- Display a number value from mysql query in WP
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- Using wpdb to connect to a different database is not working
- Why can’t i come back to older working version of php after ugrade with error log on php 7.2 and 7.3
- Insert data from form to database
- OR condition not working
- Dev and prod on the same database- dev version active for IOS
- How can I get $wpdb to show MySQL warnings?
- Prepared DB Query from _POST array
- Populate custom post type/custom fields from an external database
- mysql_escape_string PROBLEM
- how to get postmeta info based on multiple categories?
- Query does not filter duplicate _sku numbers
- Create Database Tables on Plugin Activation hook
- how to check for wordpress Query errors
- wp_postmeta – lot of meta fields
- Delete posts with word count less than x number of words
- How to create a post based on data in a table?
- MySQL: get post_tag items that are tags (not SEO keywords)
- $wpdb->get_var returns 0
- cannot log in to the mysql server (wamp and wordpress)
- Initialization of table in database using ‘CREATE … IF NOT EXISTS’
- mysqldump throws: Unknown table ‘COLUMN_STATISTICS’ in information_schema (1109)
- How do I load a sql.gz file to my database? (importing)