Joining tables, Please help

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Joining tables, Please help

    <b><u>Objective: </b></u>
    Join two DB tables to output two queries on a webpage.

    <b><u>Problem:</b></u>
    Error Diagnostic Information
    ODBC Error Code = 07001 (Wrong number of parameters)

    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

    Hint: The cause of this error is usually that your query contains a reference
    to a field which does not exist. You should verify that the fields included in
    your query exist and that you have specified their names correctly.

    The error occurred while processing an element with a general identifier of
    (CFQUERY), occupying document position (8:1) to (8:50).

    <b><u>Code::</b></u>

    <html>
    <head>
    <title>Roster Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <cfquery datasource="Trackclub" name="getoutdoor">
    SELECT Records.EventDesc, Records_Detail.EventDate, Records_Detail.FName,
    Records_Detail.LName, Records_Detail.RelayTeam, Records.Time_Mark,
    Records_Detail.Location
    FROM Records INNER JOIN Records_Detail ON Records.EventID =
    Records_Detail.EventID
    WHERE (((Records.EventID)=[records_detail].[eventid]) AND
    ((Records.Indoor_Outdoor)="o"))
    ORDER BY Records.EventID;
    </cfquery>

    <cfquery datasource="Trackclub" name="getindoor">
    SELECT Records.EventDesc, Records.Time_Mark, Records_Detail.FName,
    Records_Detail.LName, Records_Detail.RelayTeam, Records_Detail.Location,
    Records_Detail.EventDate
    FROM Records INNER JOIN Records_Detail ON Records.EventID =
    Records_Detail.EventID
    WHERE (((Records.EventID)=[records_detail].[eventId]) AND
    ((Records.Indoor_Outdoor)="i"))
    ORDER BY Records.EventID;
    </cfquery>


    <h3>Outdoor Records</h3>
    <table width="75%" border="0">
    <tr>
    <td>Event</td>
    <td>Date</td>
    <td>Names (Relay Team Members)</td>
    <td>Time/Mark</td>
    <td>Location</td>
    </tr>
    <cfloop query = "getoutdoor">
    <cfoutput>
    <tr>
    <td>#EventID#</td>
    <td>#EventDate#</td>
    <td>#Fname# #Lname# #RelayTeam#</td>
    <td>#Time_Mark#</td>
    <td>#Location#</td>
    </tr>
    </cfoutput>
    </cfloop>
    </table>


    <h3>Indoor Records</h3>
    <table width="75%" border="0">
    <tr>
    <td>Event</td>
    <td>Date</td>
    <td>Names (Relay Team Members)</td>
    <td>Time/Mark</td>
    <td>Location</td>
    </tr>
    <cfloop query="getindoor">
    <cfoutput>
    <tr>
    <td>#EventID#</td>
    <td>#EventDate#</td>
    <td>#Fname# #Lname# #RelayTeam#</td>
    <td>#Time_Mark#</td>
    <td>#Location#</td>
    </tr>
    </cfoutput>
    </cfloop>
    </table>
    </body>
    </html>







    Student_bob Guest

  2. Similar Questions and Discussions

    1. Joining three tables
      Hello all, I am having a bear of a time trying to join three tables in Sybase. Here is the query...... select DISTINCT(appl.ag_id),...
    2. Joining Multiple Tables
      I have a query that enables me to join various tables together. I managed to get all the data I need from all of the tables, aside from one, apart...
    3. joining 3 tables?
      helooo... i have 3 tables -Recipes, Ingredients and Products. Recipes table: RecipeID -PK Ingredients table: IngredientID -PK...
    4. joining 3 tables in dataset
      hi my problem is that i have to load 3 different tables from different databases into one dataset and do a join on all. i loaded all tables into...
    5. Joining Tables Across Databases
      This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ...
  3. #2

    Default Re: Joining tables, Please help

    Your error is in the where clause. You have replicated the table join in the
    where clause.

    Also, I might be way off here, but the column Records.Indoor_Outdoor by the
    name would indicate that the event is either indoors or outdoors and thus is a
    Yes/No column. Is this correct ?

    If so the WHERE clause should be WHERE Records.Indoor_Outdoor = 0 <!--- zero
    --->

    SELECT Records.EventDesc, Records_Detail.EventDate, Records_Detail.FName,
    Records_Detail.LName, Records_Detail.RelayTeam, Records.Time_Mark,
    Records_Detail.Location
    FROM Records INNER JOIN Records_Detail ON Records.EventID =
    Records_Detail.EventID
    WHERE Records.Indoor_Outdoor = "o"
    ORDER BY Records.EventID;

    Ken

    The ScareCrow Guest

  4. #3

    Default Re: Joining tables, Please help

    I made the suggested changes and it didn't work, I still got the same message.
    Also the I and O are there not as a yes or no, but ironically for Indoor and
    Outdoor, I can see where that'd be confusing though. Thanks again for any
    other help you could provide.

    Student_bob Guest

  5. #4

    Default Re: Joining tables, Please help

    The only things I can suggest is the following

    1. Ensure that you have spelt the column names correctly
    2. replace the double quotes with a single quote
    WHERE Records.Indoor_Outdoor = 'o'
    3. Use the ms access query builder to build the query.

    Ken



    The ScareCrow Guest

  6. #5

    Default Re: Joining tables, Please help

    Student_bob wrote:
    > <b><u>Objective: </b></u>
    > Join two DB tables to output two queries on a webpage.
    >
    > <b><u>Problem:</b></u>
    > Error Diagnostic Information
    > ODBC Error Code = 07001 (Wrong number of parameters)
    >
    > [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
    > SELECT Records.EventDesc, Records_Detail.EventDate, Records_Detail.FName,
    > Records_Detail.LName, Records_Detail.RelayTeam, Records.Time_Mark,
    > Records_Detail.Location
    > FROM Records INNER JOIN Records_Detail ON Records.EventID =
    > Records_Detail.EventID
    > WHERE (((Records.EventID)=[records_detail].[eventid]) AND
    > ((Records.Indoor_Outdoor)="o"))
    > ORDER BY Records.EventID;
    Single vs. double quotes matters:

    SELECT
    Records.EventDesc,
    Records_Detail.EventDate,
    Records_Detail.FName,
    Records_Detail.LName,
    Records_Detail.RelayTeam,
    Records.Time_Mark,
    Records_Detail.Location
    FROM
    Records INNER JOIN Records_Detail
    ON Records.EventID = Records_Detail.EventID
    WHERE
    Records.Indoor_Outdoor = 'o'
    ORDER BY
    Records.EventID

    Jochem

    --
    Jochem van Dieten
    Team Macromedia Volunteer for ColdFusion, beer and fun.
    Jochem van Dieten - TMM Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139