LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-15-2016, 10:38 AM   #1
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 749

Rep: Reputation: 73
Question 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.
 
Old 01-15-2016, 10:48 AM   #2
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 749

Original Poster
Rep: Reputation: 73
Found the solution:

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
best way to do multiple cells in a column of a row in a Table or something like it 1sweetwater! Linux - Software 6 12-01-2014 08:19 AM
[SOLVED] how to sort two mysql table on their date or time column golden_boy615 Programming 3 07-27-2011 03:49 AM
Importing MYSQL table from text file wo column delimiters Latios Programming 3 06-13-2011 04:03 AM
sql command to copy column from a table tooparam Programming 1 06-19-2007 05:21 AM
SQL question: Need to add a column from another table Hivemind Programming 3 09-19-2005 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration