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# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -

jquery - How to make a wrapper function in javascript? -

sql - PostgreSQL automatically update row at specific date -