Professional Web Applications Themes

Need inner Join or similar to get data from a differenttable - Coldfusion - Advanced Techniques

Hi I have a relational database I have one Table named photo_database in this table it has field called GalleryID I have another Table named LUGallery in this table it has field called GalleryName its Primary Key is GalleryID I can display all of the data from the photo_database table fine but what i want to do is display the actual name of the gallery from the LUGallery table in the field of GalleryName in stead of just displaying the numerical value for GalleryID I'm sure there is a way to do this in the SQL statement with inner join ...

Sponsored Links
  1. #1

    Default Need inner Join or similar to get data from a differenttable

    Hi I have a relational database
    I have one Table named photo_database in this table it has field called
    GalleryID
    I have another Table named LUGallery in this table it has field called
    GalleryName its Primary Key is GalleryID

    I can display all of the data from the photo_database table fine but what i
    want to do is display the actual name of the gallery from the LUGallery table
    in the field of GalleryName in stead of just displaying the numerical value for
    GalleryID

    I'm sure there is a way to do this in the SQL statement with inner join

    Any Ideas anyone

    Thanks in advance
    Kris

    Sponsored Links
    kris Guest

  2. #2

    Default Re: Need inner Join or similar to get data from a different table

    kris f wrote: 

    SELECT photo_database.*, LUGallery.GalleryName
    FROM photo_database
    INNER JOIN LUGallery ON LUGallery.GalleryID = photo_database.GalleryID

    --
    <mack />


    Neculai Guest

  3. #3

    Default Re: Need inner Join or similar to get data from adifferent table

    Thanks Neculai
    that worked fine but now what if i want to add another inner join to the SQL
    statement

    In photo_database table theres a field called PriceID
    In LUPriceSet table theres a field called PriceSetName
    you guessed it i need to get the value for PricetSetName that matches PriceID

    thanks

    kris Guest

  4. #4

    Default Re: Need inner Join or similar to get data from adifferent table

    SELECT photo_database.*, LUGallery.GalleryName, LUPriceSet.PriceSetName
    FROM photo_database
    INNER JOIN LUGallery ON LUGallery.GalleryID = photo_database.GalleryID
    INNER JOIN LUPriceSet ON LUPriceSet.PriceID = photo_database.PriceID

    Kronin555 Guest

  5. #5

    Default Re: Need inner Join or similar to get data from adifferent table

    Thanks but i get the following error

    Error Executing Database Query.
    [MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access
    Driver] Syntax error (missing operator) in query expression
    'LUGallery.GalleryID = photo_database.GalleryID INNER JOIN LUPriceSet ON
    LUPriceSet.PriceID = photo_database.PriceID'.


    kris Guest

  6. #6

    Default Re: Need inner Join or similar to get data from adifferent table

    kris f,

    Kronin555's query looks valid. Unfortunately, Access behaves a bit differently
    with joins than many of your standard db's (like sql server, sybase, mysql
    etc). When you join more than two tables, using ANSI syntax, Access seems to
    require parenthesis around some of the JOIN statements. Try changing the FROM
    clause to something like:

    --- not tested
    FROM (photo_database
    INNER JOIN LUGallery ON LUGallery.GalleryID = photo_database.GalleryID)
    INNER JOIN LUPriceSet ON LUPriceSet.PriceID = photo_database.PriceID



    mxstu Guest

  7. #7

    Default Re: Need inner Join or similar to get data from adifferent table

    Thanks heaps

    That worked perfectly first time.

    Kris
    kris Guest

Similar Threads

  1. Inner Join Across Two Data Sources?
    By tclaremont in forum Coldfusion Database Access
    Replies: 3
    Last Post: October 1st, 11:26 PM
  2. Replies: 2
    Last Post: October 22nd, 10:11 AM
  3. outer join, cross join, union? DDL/sample data incl.
    By Kevin in forum Microsoft SQL / MS SQL Server
    Replies: 3
    Last Post: August 5th, 08:01 PM
  4. Replies: 1
    Last Post: July 4th, 03:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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