You are joining the same table 2 times and hence you need to provide the unique alias name. However looks like you are looking for parts
table and hence need to join that table
SELECT categories.name, categories.sub_name, parts.name FROM categories INNER JOIN presentations ON categories.id=presentations.category INNER JOIN parts ON parts.id=presentations.parts WHERE presentations.id=5;
For better readability you can always give some short alias name something as
select c.name, c.sub_name, p.name as parts_name from categories c join presentations pr on pr.category = c.id join parts p on p.id = pr.parts where pr.id = 5
Related Posts:
- What’s the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN? [duplicate]
- How can I do a FULL OUTER JOIN in MySQL?
- MySQL Multiple Joins in one query?
- 1052: Column ‘id’ in field list is ambiguous
- 1052: Column ‘id’ in field list is ambiguous
- SQL version of VLOOKUP
- Join vs. sub-query
- select * from table where column = something or, when unavailable, column = something else
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- MySQL Error “Operand should contain 1 column”
- How to use MySQL DECIMAL?
- MySQL ERROR 1290 (HY000) –secure-file-priv option
- How do I use properly CASE..WHEN in MySQL
- MySQL server startup error ‘The server quit without updating PID file’
- Invalid column count in CSV input on line 1 Error
- Python: tuple indices must be integers, not str when selecting from mysql table
- phpMyAdmin: secret passphrase?
- Incorrect string value: ‘\xEF\xBF\xBD’ for column
- MySQL error code: 1175 during UPDATE in MySQL Workbench
- Remove duplicate values from JS array
- How to find MySQL process list and to kill those processes?
- MySQL Server on MAMP-Windows Will Not Start
- SQL statement not working – “Operand type clash: date is incompatible with int’
- MySQL starts with searching issue
- How can I rebuild indexes and update stats in MySQL innoDB?
- T-SQL: Selecting rows to delete via joins
- There can be only one auto column
- What’s a good strategy for planning WordPress DB growth?
- simple sql query on wp_postmeta very slow
- How to get the list of WooCommerce product image of a certain category from database?
- tag search using WP_Query
- How to count post meta key values for all posts in database
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- How can I SQL update a meta_value to remove the dollar signs that were entered with the value? (so just the value remains)
- Error establishing a database connection – with Debug Data
- Database with mixed collation (utf8mb4 & utf8_general_ci)
- Grouping related postmeta data via SQL query
- How can I make wordpress suppress mysql errors?
- Is it good practice to use wpdb->query() function?
- Delete all post meta except featured image Using SQL
- Adding new row to wp_post table
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- How to determine what is generating large amount of database queries?
- Get post by ASC from custome field DATE picker
- Performance when getting post meta for post retrieved by meta value
- Can’t get wp_insert_post to work
- Connect another DB and fetch records from some tables
- Delete all one-word comments
- mysql query from wordpress page using custom table
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How to select from two different tables to display orders list with custom column from other table
- Error: MySQL shutdown unexpectedly [closed]
- Enabling WP_USE_EXT_MYSQL to support old plugin
- Enabling plugin failed because MySQL user do not have CREATE permissions
- Cleaning up bloated wp_postmeta table by removing multiple _thumbnail_id’s?
- Not connecting to database in file with multiple MySQL connections
- Way to bulk make all my tags lowercase?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- create new users in db starting at what ID?
- Delete post results in “Cannot delete or update a parent row: a foreign key constraint fails”
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- Importing WordPress Posts With Custom Meta Data As CSV Files Through PHPMyAdmin
- email alert for product availability
- how to insert missing tags into the posts through mySQL?
- How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option
- SQL query to set posts in bulk based on the post content
- How can I detect right db type?
- How to insert dash (-) into database using wpdb and new_to_publish hook?
- MySQL: How to change url in posts from xxx.com to yyy.org?
- Second ezSQL initialization for MSSQL
- Fetch a single row from a custom table for to a given ID
- Database create or redirect
- WordPress paginate_links function: How do i ensure the page number is not less than 1 and not greater than last
- WordPress low speed after migrating to new host
- JOIN and SUM different statement results (Mailster Database)
- Button writing to MYSQL database
- How to escape percentage sign(%) in sql query with $wpdb->prepare?
- MySQL ‘duplicate entry’ error
- Performing CRUD operations on front end in wordpress
- Deleted products from woocommerce are still in the database
- Displaying data from custom table
- WordPress Dutch characters encoding problem
- Add postmeta to all blog posts
- HyperDB failover Delay
- Select latest 2 articles, but only from given category
- Error while submitting form using AJAX and php
- CONCAT_WS in custom sql query
- How to extract some part of WordPress full source code
- Ordering topics by most replies in X days using MYSQL statement
- WordPress upload images not displaying
- Slow WordPress admin panel with a total query time of 1664ms
- Running WordPress from MySQL Cluster with HAPRoxy
- Query Concatenation
- SQL command to export post_content from wp_posts using phpMyAdmin
- Display total count of products in orders of a specific order status
- Where is my mysql log on OS X?
- Can running a WP-Cron to update_post_meta cause performance issues?