James Brown
James Brown

Reputation: 13

Show all records using INNER JOIN

I am familiar with INNER JOIN just enough to understand the basics. But is there a way that I can select all records from both tables without cluttering the SQL sting with each column name. I was thinking in the line with the below code

SELECT * FROM new_case
INNER JOIN dispatch
ON new_case.file_nr = dispatch.case_nr
WHERE new_case.id = '27'

Upvotes: 0

Views: 180

Answers (2)

Kaede
Kaede

Reputation: 198

This is what i'd try;

SELECT ft.*, af.* FROM new_case ft INNER JOIN dispatch af ON (ft.file_nr = af.case_nr) WHERE new_case.id = '27'

Upvotes: 1

AreEl
AreEl

Reputation: 61

Results from both tables:

SELECT nc.*, d.* FROM new_case nc INNER JOIN dispatch d ON nc.file_nr = d.case_nr WHERE nc.id = '27'

Upvotes: 0

Related Questions