ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 13th, 2006, 11:14 PM
jionjo jionjo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 1 jionjo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 30 sec
Reputation Power: 0
Union Query - Undefined

I am trying to run the following query but I get a "Variable CALID (Replace CALID with any variable) is undefined"

If I do a cfdump the query returns the right results.

If I do each query seperatly I do not get the undefined error.

However, when I add use the UNION to combine the queries, I get the undefined error.

The query is as follows:

<cfquery name="Testunion" datasource="cscms">
SELECT AGREEMENT_END_DATE, ID
FROM Data1
WHERE Data1.AGREEMENT_END_DATE IS NOT NULL AND Data1.AGREEMENT_END_DATE Between Now() and Now ()+360 AND Data1.REQUESTING_DEPT = 'IT'

UNION ALL

SELECT EventDate, CalID
From Calen
WHERE Calen.EventDate IS NOT NULL

ORDER BY Data1.CONTRACT_END_DATE, Data1.ID, Calen. EventDate
</cfquery>

------------------------

Now maybe there is a better way to this, but I am trying to take the information from the Data1 Table and the Calen Table and display it in rows by date order.

Any help would be greatly appreciated, I spent enough time trying to figure this out already, so that must mean the answer is simple.


Reply With Quote
  #2  
Old July 14th, 2006, 12:55 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,743 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 21 h 7 m 14 sec
Reputation Power: 62
General SQL debugging tips:
  1. Run the query in your SQL tool to confirm it works.
  2. Confirm the data types of all columns and adjust the SQL accordingly.
  3. If necessary, remove all columns from the query except one, and run it. If it runs successfully, add one more column and test again. Continue adding one column at a time until you discover the field that is causing the error.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Union Query - Undefined


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT