How to get first table value instead of second table while joining in php

Actually i am joining teo tables in that both the tables are status and default it will display second table value only…, But i want to show first table status(value)

  SELECT  * from size_master 
  inner join  product_category on size_master.pcat_id= product_category.pcat_id;

Here both table have status-how to get only first table column values…?

thanks,

You need to ALWAYS list out the columns you are selecting so that you only retrieve the data that you want. In the case of a JOIN query, you should use simple/short table alias names. When you list a column you would use the table_alias_name.column_name syntax. This will solve your immediate problem since you would only list the status column that you want. If you have a need to select more than one same named column from the JOINed tables, you would give the (later) columns unique alias names. The column values would be referenced in the result set using the column alias name(s).

got it…
thank you

Sponsor our Newsletter | Privacy Policy | Terms of Service