Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8456237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:29:44+00:00 2026-06-10T12:29:44+00:00

I have the following table join that runs fine in Microsoft SQL Server and

  • 0

I have the following table join that runs fine in Microsoft SQL Server and returns the expected results.

SELECT     d.id1, c.content_type
FROM       Document2 AS d INNER JOIN
           Content2 AS c ON d.content_id = c.content_id
WHERE     (d.class_id = 1)

However when I place the statement into a ColdFusion CFC, the statement will not execute and I am not getting anything to return. Does the syntax change within the CFC file? Is the Microsoft SQL syntax different from the ColdFusion CFC syntax? Or am I missing something else here?

This is the relevant function. I can get this code to work if I use a simple SQL statement that is not a table join. However, when I insert the table join statement nothing will return.

  remote array function getcontent() {
    var q = new com.adobe.coldfusion.query();
     q.addParam( name="searchParam", value="#searchName#" );
    q.setDatasource("Document");
    q.setSQL("SELECT d.id1, c.content_type FROM Document2 
    AS d INNER JOIN   
    Content2 AS c ON d.content_id = c.content_id WHERE (d.class_id = 1)");

    var data = q.execute().getResult();
    var result = [];
    for(var i=1; i<= data.recordCount; i++) {
        arrayAppend(result, {"id"=data.d.id1[i], "Type"=data.c.content_type[i]});
    }
    return result;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:29:46+00:00Added an answer on June 10, 2026 at 12:29 pm

    The problem is this line of code:

    arrayAppend(result, {"id"=data.d.id1[i], "Type"=data.c.content_type[i]});
    

    You don’t refer to database variables like that – the table alias is not part of the column alias.

    You should simply use:

    data.id1[i]
    

    If you did actually have a . in the column alias, then you would need to refer to it using bracket notation, like this:

    data['d.id1'][i]
    

    But again, the table alias isn’t part of the column alias, so that’s not needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following SQL Query which runs on SQL Server CE 4 SELECT
I have the following table that serves to join 3 tables: ClientID int BlogID
I have the following query with join table that works great: @eventsmy = Event.find(
I have the following table in SQL Server 2008: CREATE TABLE tbl (ID INT,
I have the following MySQL query statement: SELECT * FROM table1 INNER JOIN table2
I have a query with a self join that looks like this, select t1.
I have the following code that I was helped with. var results = from
I have the following query that when executed, it just runs for hours and
I have a join table that I'm using to find available services for an
I have 3 tables that I need to join, these join together fine using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.