• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Inner Join Necessary???

Community Beginner ,
Nov 30, 2006 Nov 30, 2006

Copy link to clipboard

Copied

Its been forever since I've had to do an application and, not surprisingly, am having stupid difficulties. I have 3 tables. I need to output from each of them - all of the info - based on ID.

this is my query thus far... I am sure I'm missing some key stuff - maybe an Inner Join?? Thanks!!

<cfquery datasource="aqxdretire" name="allinfo">
select names.retireid, names.firstname, names.mi, names.lastname, names.fromdate, names.primaryemail, names.secondaryemail, names.matrixafsc, names.careerfld, names.certlvl, services.sandt, services.progmngt, services.contracting, services.engineering, locations.hanscom, locations.la, locations.wp, locations.edwards, locations.eglin, locations.tinker, locations.hill, locations.warner, locations.kirtland, locations.rome, locations.dc
from names, services, locations
WHERE names.retireid = services.retireid AND names.retireid = locations.retireid
</cfquery>

TOPICS
Advanced techniques

Views

296

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 30, 2006 Nov 30, 2006

Copy link to clipboard

Copied

You are doing an "inner join" using the old syntax by including the tables in the FROM and "joining" them in the WHERE. What results are you getting that are different than what you expect?

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2006 Nov 30, 2006

Copy link to clipboard

Copied

I'm not getting any results. Just that I'm getting an error... that's it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 30, 2006 Nov 30, 2006

Copy link to clipboard

Copied

What's the error message? By the way, since you are requesting so many fields, a good format for debugging is:

select names.retireid
, names.firstname
, names.mi
, names.lastname
, etc
,locations.dc

from etc

It makes it easy to see if you are missing any commas.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 30, 2006 Nov 30, 2006

Copy link to clipboard

Copied

LATEST
If you have no results then your WHERE clause is to blame, and you have no case where the same retireid exists in all three tables. Are you sure that you want to be doing an INNER JOIN?

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation