InnerJoin not working

Hi- Here is my query:

<CFQUERY  NAME="get_products">
    SELECT     *
    FROM      products INNER JOIN sizes
      ON  products.id=sizes.product_id
      WHERE active='1'
</CFQUERY>

But I get an coldfusion error, "Attribute validation error for tag CFQUERY.  
The tag has an invalid attribute combination: name."  

If I do this, it pulls properly, but I can't have the WHERE Active='1' parameter:

<CFQUERY DATASOURCE="#request.maindsn#" NAME="get_products">
    SELECT     *
    FROM      products, sizes
      WHERE products.id=sizes.product_id
</CFQUERY>


mel150Asked:
Who is Participating?
 
SidFishesCommented:

oops that last bit should be

<CFQUERY DATASOURCE="#request.maindsn#" NAME="get_products">
    SELECT     *
    FROM      products INNER JOIN sizes
     ON  products.id=sizes.product_id
     WHERE products.active=1 <!--- I'm guessing Active is in Products Table --->
</CFQUERY>
0
 
SidFishesCommented:
unless Active datatype is text (char, varchar, text etc)

 needs to be

  WHERE active=1

0
 
mel150Author Commented:
Aha! Thanks! I will test a little later and get back to you.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
mel150Author Commented:
Hi- Now I have:

<CFQUERY  NAME="get_products">
    SELECT     *
    FROM      products INNER JOIN sizes
      ON  products.id=sizes.product_id
      WHERE active=1
</CFQUERY>

And I am still getting the same error.."Attribute validation error for tag CFQUERY.  
The tag has an invalid attribute combination: name."  Here are more details from the error:

The tag has an invalid attribute combination: name. Possible combinations are:<li>Required attributes: &apos;datasource&apos;. Optional attributes: &apos;blockfactor,cachedafter,connectstring,dbname,dbpool,dbserver,dbtype,debug,maxrows,name,password,provider,providerdsn,sql,timeout,username&apos;. <li>Required attributes: &apos;datasource&apos;. Optional attributes: &apos;blockfactor,cachedwithin,connectstring,dbname,dbpool,dbserver,dbtype,debug,maxrows,name,password,provider,providerdsn,sql,timeout,username&apos;. <li>Required attributes: &apos;dbtype&apos;. Optional attributes: &apos;blockfactor,cachedwithin,connectstring,datasource,dbname,dbpool,dbserver,debug,maxrows,name,password,provider,providerdsn,sql,timeout,username&apos;. <li>Required attributes: &apos;dbtype,name&apos;. Optional attributes: &apos;cachedwithin,debug,maxrows,sql,timeout&apos;. <li>Required attributes: &apos;dbtype,name&apos;. Optional attributes: &apos;cachedafter,debug,maxrows,sql,timeout&apos;.

Any other thoughts? :)

Thanks!
0
 
SidFishesCommented:
hmmm...3 issues perhaps

Use

Active  = 1


you have to have datasource (this is the source of the attirbute error near name

<CFQUERY DATASOURCE="#request.maindsn#" NAME="get_products">

you'll need to scope your Active value


<CFQUERY  NAME="get_products">
    SELECT     *
    FROM      products INNER JOIN sizes
     ON  products.id=sizes.product_id
     WHERE products.active=1 <!--- I'm guessing Active is in Products Table --->
</CFQUERY>
0
 
mel150Author Commented:
Rockin!! Thanks so much.

Mel
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.