Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I create this SQL query that has to join four tables to allow me extract the data I need?
    primarykey
    data
    text
    <p>What I want to do is a PHP script that gets all the products of a Joomla VirtueMart using PHP and mySQL. However my question has nothing to do about Joomla or PHP but I am in the need of a mySQL query.</p> <p>Below you can find the tables and the fields that holds the data I need which are</p> <p><strong>product_id, product_desc, product_full_image, product_name, product_price, category_name.</strong></p> <p>To get the <strong>product_price</strong> you will need the <strong>product_id</strong> from <code>jos_vm_product</code> and match it with the <strong>product_id</strong> from <code>jos_vm_product_price</code> to get the <strong>product_price</strong>.</p> <p>Every <strong>product_id</strong> has a <strong>category_id</strong> inside <code>jos_vm_product_category_xref</code>. So, when the <strong>category_id</strong> is found, you get the <strong>category_name</strong> from <code>jos_vm_category</code>.</p> <p>This is difficult for me as I am not very familiar with SQL queries and I need your help on how to to join those tables, so it will allow me to echo the values I need.</p> <p>Thank you.</p> <p><strong>jos_vm_poduct</strong></p> <pre><code>product_id product_desc product_full_image product_name </code></pre> <p><strong>jos_vm_product_price</strong></p> <pre><code>product_id product_price </code></pre> <p><strong>jos_vm_product_category_xref</strong></p> <pre><code>product_id category_id </code></pre> <p><strong>jos_vm_category</strong></p> <pre><code>category_id categroy_name </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload