select - Mysql Join rows from multiple tables -


I'm asking here because I should find the English word I want for it. I can solve it with many questions I can be involved in the ear and for the front end, but why should we do it, if there is a clever way.

My query now looks like:

  SELECT P *, Products from Pi.path, pv.videoid products JOIN Productivity PO (PID = P. Product) JOIN Product Video PY O (PID = PV Product) WHERE p.id =: id  

look like my table

Products:

  | --- id --- | --- name ---- | - --desc --- | --- value --- | --- Active ---- | | --- 1---- | --- somet --- | --- DSA ---- | --- 456 ----- | --- 1/0 ------- | | --- 2 ---- | --- somet2-- | --- ddsasa- | --- 44,556 --- | --- 1/0 ------- |  

Product Video:

  | ---- ID ---- | --- Products ---- | ---- VideoID ------ | | ---- 4 ----- | --- 1 ---------- | ----- youtubeid ---- | | ---- 4 ----- | --- 1 ---------- | --secondyoutubeid- |  

is similar to the video for the images, and I want to do this for the files

To make it easy,

 Get the  // $ stmt-> result; All (PDO :: FETCH_ASSOC); $ Arr = array (0 = & gt; array ("id" => 1 "," name "=>" Hello World "," category "=>," 3 "," videoid "= ("Imagepathofproduct", "secondimageofproduct") "1yyoutubeid", "secondid", and "Arrow" ("product" = "gtc: mediawiki-xid =" 1 "), 1 is for this product which is" "4", "Category" = "4", "Category" = "1" & gt; Array ("id" =>, "2", "name" => "Hello World Product 2", " Video "path" => Array ("ImagePathofproduct", "Second Gemfproduct"), "Active", and "VideoID" => Array ("One-YouTube" "Seconded", "Threaded"), // Video "Path" for this product = = & Gt; "1");); use it like this For: Return $ stmt->; fetchAll (PDO :: FETCH_ASSOC); and start foreign currency to display data   

thankyou lot

resolved by concat and I will be exploding in array but still waiting for more smart solutions.

Solution:

  SELECT p. *, GROUP_CONCAT (PIID different path order by PIID) images, as the products from GROUP_CONCAT (separate videod order BY pi.id) products, POIN (PIID =Shri. Product) JOIN Product Video PV On (PID = PV Product) Where PID = 1  

Home This will help someone


Comments