M
M
MaoCzedun2015-07-02 13:53:30
MySQL
MaoCzedun, 2015-07-02 13:53:30

How is a request made?

In general, the question is, what is executed for what, I’m not strong in joins, so I want to understand what is first executed, what is after, the answer is preferably in the form 1 is executed then 2 is performed then and so on. And how Group By
Request works

SELECT barcommen.comments_text,
    barcommen.product_id,
    barcommen.company_id,
    barcommen.status,
    barproducts.product_article,
    barprodobj.product,
    barprodprice.price
FROM       `barmen_comments` as barcommen 
    INNER JOIN `barmen_products` as barproducts ON barproducts.product_id=barcommen.product_id
    INNER JOIN `barmen_products_objects` as barprodobj  ON barprodobj.product_id=barcommen.product_id
    LEFT  JOIN `barmen_products_prices` as  barprodprice ON barprodprice.product_id=barcommen.product_id
    WHERE    barcommen.company_id=111 and barcommen.productOrCompany=0
    GROUP BY comments_text;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Ukolov, 2015-07-02
@alexey-m-ukolov

Add before SELECT EXPLAIN and see for yourself.

A
Artyom Karetnikov, 2015-07-02
@art_karetnikov

Доброго. Легко отвечу, что за чем выполняется и вообще научу sql. Заодно ткну в ошибки, как минимум одна потенциальная тут есть. Будет желание - скайп и емейл мой тут указаны, договоримся.
А бесплатно рассказывать, что как и почему - как видите, охотников мало тратить свое время просто так.

S
Stalker_RED, 2015-07-02
@Stalker_RED

habrahabr.ru/post/31129

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question