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

  1. #1

    Default query tweaking

    Getting an error - Mike havent put in the extra column yet - just test running
    at the moment. Sql at the bottom.

    Language: Table
    Language_id Language_name
    1 ???????
    2 ???????
    3 ???????
    4 ??????????
    5 ??????
    6 ???????
    7 ???????

    Hospital: Table
    Hospital_id Hospital_name ??????? ??????? ??????? ????? ?????? ???????
    1 Sapporo Hokkaido Yes Yes No No No No
    2 Dental?Treatment?Centre No Yes No No No No
    3 Health?University?of?Hokkaido? No Yes No No No No
    4 Higashi?Sapporo?Hospital Yes Yes No No No No
    5 Hokkaido?University?Hospital Yes No No No No No
    6 National?Sapporo?Hospital Yes No No No No No
    7 Sapporo?Hospital Yes No No No No No
    8 Sapporo?Medical? Yes No No No No No

    LanguagesbyHospital: Table
    hospital_id language_id
    1 1
    4 1
    5 1
    6 1
    7 1
    8 1
    1 2
    2 2
    3 2
    4 2

    The Sql

    SELECT Hospital_name
    FROM Hospital
    INNER JOIN
    LanguagesbyHospital ON LanguagesbyHospital.Hospital_id=Hospital.Hospital_ id
    INNER JOIN
    Language ON Language.Language_id=LanguagesbyHospital.Language_ id, "Language"
    WHERE Language.Language_name= 'English'

    quiero mas Guest

  2. Similar Questions and Discussions

    1. tweaking cf validation
      i want to edit the js validation for html cfforms. can anyone tell me where the file that contains the js is located? i need to comment out the...
    2. Tweaking 'Create a New Php Script' file
      File > New > Create New PHP Script generates the same basic code everytime. How can I add a new line of code to that file so that everytime I create...
    3. Tweaking cfchart
      I am trying to construct a scatter chart where points are displayed from 0.85 to 1.15, I also would like to control the distance between the points...
    4. tweaking acks and pings
      dslreports.com tweaks page recommends that I turn on "selective acks", but gives only the windows method for doing so. Also, my machine is...
    5. tweaking digital photo
      I have a digital camera which i would like to take a photo of different rooms in my house,and then with the use of a program change the floor color...
  3. #2

    Default Re: query tweaking

    the error is?

    id say it is on the line
    Language ON Language.Language_id=LanguagesbyHospital.Language_ id, "Language"

    the error being the text after the comma.
    Scott*e Guest

  4. #3

    Default Re: query tweaking

    ?????????????e

    Sorry i meant to say that i can oull the results from the query and that was
    the error.

    Im really in the dark as anyone who has been puttting up with my inane
    questions will know. I went back and checked things. I went into Access and
    got sql rolling fine in there - i thought i might just be able to paste the
    sql from there but without luck.
    i would appreciate any feedback
    regards MArk - thinking of changing my name to NOOB


    The Sql
    <cfquery name="lbyh" datasource="simple">
    SELECT Hospital.Hospital_name, Language.Language_name
    FROM Language INNER JOIN LanuagesbyHospital INNER JOIN Hospital ON
    LanuagesbyHospital.hospital_id = Hospital.Hospital_id ON Language.Language_id =
    LanuagesbyHospital.language_id
    WHERE Language.Language_name = 'English'
    </cfquery>


    <body>
    <form name="form1" method="post" action="LanguagesbyHospitalresult.cfm">
    <label>
    <input type="submit" name="Submit" value="Submit">
    </label>
    <label>
    <select name="select">
    <option value="1">English</option>#Is this the correct way to label the
    Option values - correspond to the language_id ?
    <option value="2">Russian</option>
    <option value="3">Spanish</option>
    <option value="4">Portuguese</option>
    <option value="5">Korean</option>
    <option value="6">Chinese</option>
    <option value="7">Tagalog</option>
    </select>
    </label>
    </form>

    </body>
    </html>

    I have got this working without any problems in Access.
    Access
    SELECT Hospital.Hospital_name, Language.Language_name
    FROM [Language] INNER JOIN (LanuagesbyHospital INNER JOIN Hospital ON
    LanuagesbyHospital.hospital_id = Hospital.Hospital_id) ON Language.Language_id
    = LanuagesbyHospital.language_id
    WHERE (((Language.Language_name)="English"));

    quiero mas Guest

  5. #4

    Default Re: query tweaking

    Meant to say cant pull out
    arrh going nuts
    quiero mas Guest

  6. #5

    Default Re: query tweaking

    Could be that Language is a reserved word which shouldn't be used for a table
    name. Change it to Languages and see if that helps.

    By the way, that's a guess, I don't use MS Access myself.

    Originally posted by: Scott*e
    the error is?

    id say it is on the line
    Language ON Language.Language_id=LanguagesbyHospital.Language_ id, "Language"

    the error being the text after the comma.



    Dan Bracuk Guest

  7. #6

    Default Re: query tweaking

    Yes, "Language" is a reserved word But not in Access.
    It's a Coldfusion reserved word in queries. (Which 'splains why direct access
    worked but CFM didn't.)

    This brings up a good point for a beginner...

    Get in the habit of using a naming style for everything you code.
    For example, you might name all tables like this:
    tLanguageList, tHospitalList, etc.
    The "t" is a prefix that signifies that tLanguageList is a SQL table and not a
    string, query or integer, etc.

    -- MikeR



    MikerRoo Guest

  8. #7

    Default Re: query tweaking

    Great you guys are the best - actually i cant believe how much other stuff i learn when i try and find out why somethings not going right - hope it comes in handy some day

    Much appreciated
    Mark
    quiero mas 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