Note that there are some explanatory texts on larger screens.

plurals
  1. POfetch data from multiple tables
    primarykey
    data
    text
    <p>I have 4 table for my Ads Portal. Firstly main table name is <strong>ads</strong></p> <pre><code>+-------------+ | Field + +-------------+ | id + | ads_title + +-------------+ </code></pre> <p>example data for ads table;</p> <pre><code>+----+-----------------+ | id | ads_title | +----+-----------------+ | 20 | 2006 CITROEN C4 | | 27 | EMEKLI OGRETMEN | | 28 | Harika 10 n | | 34 | HATASIZ BOYASIZ | | 49 | BAYANDAN 2009 | +----+-----------------+ </code></pre> <p>for ads specifications stored in a table. table name is <strong>ads_spc</strong></p> <pre><code>+---------+ | Field | +---------+ | id | | key_name| +---------+ </code></pre> <p>data example for ads_spc table;</p> <pre><code>+----+-------------+ | id | key_name | +----+-------------+ | 1 | Date | | 2 | Km | | 3 | Colr | | 4 | Engine | | 5 | Pw. Engine | | 6 | Oil | | 7 | Speed | | 8 | Boody Type | | 9 | Traction | | 10 | Warranty | +----+-------------+ </code></pre> <p>Lastly stored specification values for ads_spc by ads_id. table name is <strong>ads_values</strong></p> <pre><code>+------------+ | Field | +------------+ | id | | ads_id | | spc_id | | value | +------------+ </code></pre> <p>for example this table data</p> <pre><code>+----+--------+--------+-------+ | id | ads_id | spc_id | value | +----+--------+--------+-------+ | 25 | 49 | 9 | 2119 | | 26 | 49 | 10 | 2131 | | 27 | 34 | 1 | 2010 | | 28 | 34 | 2 | 8900 | | 29 | 34 | 3 | 4 | | 30 | 34 | 4 | 22 | | 31 | 34 | 5 | 40 | | 32 | 34 | 6 | 60 | | 33 | 34 | 7 | 65 | | 34 | 34 | 8 | 66 | +----+--------+--------+-------+ </code></pre> <p>I want to using these tables list ads (table: ads) with specifications (table:ads_spc) and ads values (table:ads_values) in a data row.</p> <p><strong>Union to;</strong> ADS + ADS_SPC + ADS_VALUES (All values searchable)</p> <p>I'm using this case: </p> <pre><code>SELECT SQL_CALC_FOUND_ROWS * FROM ads AS a LEFT JOIN ads_spc AS aspc LEFT JOIN ads_values AS aval ON aval.ads_id=a.id AND aval.spc_id=aspc.spc_id </code></pre> <p>How can I union to one row? Sorry for my english.</p>
    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