LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   MySQL run SELECT on a table if column A form table 1 equals column A from table 2 (https://www.linuxquestions.org/questions/linux-software-2/mysql-run-select-on-a-table-if-column-a-form-table-1-equals-column-a-from-table-2-a-4175564029/)

robertjinx 01-15-2016 10:38 AM

MySQL run SELECT on a table if column A form table 1 equals column A from table 2
 
Hello, I've got a mysql database which has to tables, both having some information, but one of the column are used for the same information and would like to run a SELECT and/or DELECT on table 1 while column A value from table 1 equals column A value from table 2.

I've searched online, found something with INNER JOIN, but couldn't understand sh*t from it :(

something like this I'm thinking of:

Quote:

db name = mydb
table 1 name = tbl1
table 2 name = tbl2
column A name = data

USE mydb; SELECT * from tbl1 WHERE data.tbl1 = data.tbl2;
This is the idea, this doesn't work, of course.

robertjinx 01-15-2016 10:48 AM

Found the solution:

Quote:

select count(tbl1.column_A) from tbl1 inner join tbl2 on tbl2.column_A = tbl1.column_A;


All times are GMT -5. The time now is 10:24 PM.