mysql - Getting rows of a table based on query on another table -


I have these 2 tables

  [product] id company id, name, part No, IDS Group, for the company name to search the user, when searching for a company name, I have to show this column:  
  company name, product. Name, Product. Part, Product IDS Group  

Find me the company ID from this search query

  Choose company.ID from the company where "$ userSearch%" such as WHERE Company.Name < / Code> 

Now I want to use Company.ID for this query to get all the products from the product.

  Select * Product from WHERE Company ID = "ID from previous query"  

If it's in the same database, then you just have to Join Tables

< Code> Select Company. Name, Product. Name, Product. Partano, Products Company on products leaving company from IDS Group Id = products. Companad is where the company Name LIK e "$ userSearch%"

Comments

Popular posts from this blog

c++ - Cmake produces file extensions in static library archives -

c# - Roxy file manager in MVC doesn't accept session path -

c# - XML - Serialize class - Some questions -