• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

MySql query


I have three simple DB tables and I'm trying to do a couple queries which should be simple but I seem to be getting stuck.

First I have 2 Tables with 3 columns in them.

TABLE1 with Col1, Col2 and Col3

TABLE2 with Col1, Col2 and Col3

I want to know if any data in TABLE1.Col1 matches TABLE2.Col1 and if so I want to produce a list.

Next TABLE1 and TABLE2 list qty of units. TABLE3 list other information such as descriptions. So I need to look at TABLE3.Col4 match it to either TABLE1.col1 or TABLE2.col1 and check TABLE1.Col2 and/or TABLE2.Col2 to determine if there is more than X available. If there is more than X available than I need to get all data from TABLE3 and the Col2 data from TABLE1 or TABLE2.



1 Solution
probably you're looking for joins:

select a.*, b.*, c.*
from table1 a
join table2 b on a.col1 = b.col1
join table3 c on b.col2 = c.col4
JohnAuthor Commented:

Sorry for the late response.

Thanks for the help!!!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now