EasyCFM.COM ColdFusion Forums / Coding Help! / database query

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: database query

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

cabry
12-01-2009 @ 2:28 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 94
Joined: Dec 2005

Hi I am trying to query to tables and i seem to be getting an error and i cannot see at all where my error is.  Could someone please help me it is driving me mad.

Thanks


<cfquery name="questions" datasource="kwanser">
SELECT
s.expertid,
s.questionid,
s.question,
s.userid,
s.area,
f.expertid,
f.answerid,
f.answer
FROM questions s, answer f
WHERE s.expertid=#expertid#
and  f.expertid=s.expertid
     </cfquery>


falconseye
12-01-2009 @ 4:26 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 1033
Joined: Mar 2004

what's the "error" ?

http://www.fuzzysiberians.com

dlackey
12-02-2009 @ 9:04 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

what kind of database is it, too?  

Cheers,
Chip

cabry
12-03-2009 @ 1:02 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 94
Joined: Dec 2005

Unfortunatly at the moment it is only access. I know that is the worse one to use but its what my boss wants at this present time

It is giving me the error

Error Executing Database Query.  
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.  
  
The error occurred in C:\Inetpub\wwwroot\CFDOCS\kwanser\login\expert\questions.cfm: line 46

44 : f.answer
45 : FROM questions s, answer f
46 : WHERE s.expertid=#expertid#
47 : and  f.expertid=s.expertid
48 :      </cfquery>


I know there is probably something really small but i just cant seem to see it.

dlackey
12-03-2009 @ 3:30 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

try this:

SELECT
s.expertid,
s.questionid,
s.question,
s.userid,
s.area,
f.expertid,
f.answerid,
f.answer
FROM questions as s inner join answer as f  ON s.expertid = f.expertid
where s.expertid=#expertid#

Cheers,
Chip

Sponsored By...
iOpenSoft, LLC is a Houston, Texas Advanced Technology Studio Specializing in Web Design, Web Development, iPhone App Development and Android App Development.