0

I got mySQL query like this:

SELECT * 
FROM products_description pd 
LEFT JOIN products zp 
   ON pd.products_id = zp.products_id 
LIMIT 0 , 1000

This simply joins two tables together, and outputs columns and rows based on the same product id. Now I need only to narrow the columns to two, column_a AND column_b

How do I go about it?

@EDIT When two tables are joined am unable to get primary key in order to edit the table. How do I go around it to have primary key (unique) and make the table editable when joined.

pasujemito
  • 312
  • 4
  • 16
  • If you just want to return `column_a` and `column_b`, then don't use `select *` use `select column_a, column_b...` – Taryn Feb 21 '14 at 17:33

3 Answers3

0
SELECT column_a, column_b
FROM products_description pd 
LEFT JOIN products zp 
   ON pd.products_id = zp.products_id 
LIMIT 0 , 1000
vekah
  • 980
  • 3
  • 13
  • 31
0

you need just to select those two columns

  SELECT column_a , column_b
  FROM products_description pd 
  LEFT JOIN products zp 
  ON pd.products_id = zp.products_id 
  LIMIT 0 , 1000
echo_Me
  • 37,078
  • 5
  • 58
  • 78
0

Try this, SELECT pd.column_a, pd.column_b

SELECT pd.column_a, pd.column_b
FROM products_description pd 
LEFT JOIN products zp 
   ON pd.products_id = zp.products_id 
LIMIT 0 , 1000
Krish R
  • 22,583
  • 7
  • 50
  • 59
  • This is the working output :) Thanks `SELECT products_name, products_weight FROM products_description pd LEFT JOIN products zp ON pd.products_id = zp.products_id LIMIT 0 , 1000` – pasujemito Feb 24 '14 at 11:01