•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 426,180 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,819 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser: Programming Forums
Views: 1743 | Replies: 3
![]() |
•
•
Join Date: Apr 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
I use to be a bit of a wiz at coldfusion 4, but I havent used it in quite a WHILE! Now its at version 7 and what I remember doesnt seem to work anymore...
I am trying to write a 'news' page, it takes data from two tables... news and users.
It will display the title and story from the news table and the username from the users table. The two tables will be joined by the userid which is the same in both tables....
Here is my query, that use to work in old version 4!
But it just comes up with this error:
Any help would be greatly appreciated, and once I have got over this rather easy milestone, I will be able to get on with it!
Thanks,
William
I use to be a bit of a wiz at coldfusion 4, but I havent used it in quite a WHILE! Now its at version 7 and what I remember doesnt seem to work anymore...
I am trying to write a 'news' page, it takes data from two tables... news and users.
It will display the title and story from the news table and the username from the users table. The two tables will be joined by the userid which is the same in both tables....
Here is my query, that use to work in old version 4!
<cfquery datasource=#db# name=test> SELECT * FROM news, users WHERE news.userid = users.userid </cfquery>
But it just comes up with this error:
•
•
•
•
Error Executing Database Query.
Type mismatch in expression.
The error occurred in C:\CFusionMX7\wwwroot\cfdocs\jericho\index.cfm: line 1
1 : <cfquery datasource=#db# name=test>
2 : SELECT *
3 : FROM news, users
Any help would be greatly appreciated, and once I have got over this rather easy milestone, I will be able to get on with it!
Thanks,
William
•
•
Join Date: Jan 2007
Location: Austin, TX
Posts: 30
Reputation:
Rep Power: 2
Solved Threads: 0
I have not used CF much since version 5... I would try running your query against the database outside of ColdFusion and fetching all the rows. That may help isolate where the problem is. If the problem turns out to be with the query, you may want to check the data type of the columns you are joining. Some database will automatically convert a string to a number which works fine until you bump into a string that cannot be converted because it has alpha characters in it. If they have different data types, try adding a TO_CHAR or TO_NUMBER conversion.
Dan Moore
www.danmoore.org
www.danmoore.org
•
•
Join Date: Jan 2007
Location: Austin, TX
Posts: 30
Reputation:
Rep Power: 2
Solved Threads: 0
•
•
•
•
You still need to set star per table even though you want all from each.
<cfquery datasource=#db# name=test>
SELECT news.*, users.*
FROM news, users
WHERE news.userid = users.userid
</cfquery>
Perhaps in some databases, but I know it is not the case with Oracle at least. However, your point makes me wonder what ColdFusion does when it gets back two columns named "userid". I could see how the confusion from that might cause an error.
Dan Moore
www.danmoore.org
www.danmoore.org
![]() |
•
•
•
•
•
•
•
•
DaniWeb ColdFusion Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- struts tutorials (Java)
- SQL Queries help (Database Design)
- Create Access Database using SQL queries (MS Access and FileMaker Pro)
- Multiple queries within one php file (PHP)
- Updating database with related tables and queries?? (VB.NET)
- Log files for submitted LDAP queries (Windows NT / 2000 / XP / 2003)
- Using exisiting queries within MS Access (ASP.NET)
- FULLTEXT searching (MySQL)
- securit issues fundamental - few queries - follow up (Viruses, Spyware and other Nasties)
- request for ansi sql queries equalent to MS access (Visual Basic 4 / 5 / 6)
Other Threads in the ColdFusion Forum
- Previous Thread: Run exe file using Coldfusion
- Next Thread: Passing a structure into an Oracle Procedure


Linear Mode