Ask a Question related to Coldfusion Database Access, Design and Development.
-
KimMazz #1
Inner Join Query
Hello Everyone, it's been ages since I posted here, but I just don't get
table joins. The background, I am working with an Access db. There are
currently 2 tables, tbl_Images and tbl_Category. The field
tbl_Images.ImgCategory is a "look up" gotten by table/query from the
tbl_Category.CategoryID. Which is the primary key in tbl_Category.
I am trying to get all the data from tbl_Images and the tbl_CategoryName
from the tbl_Category. tbl_Images holds fields ImgID, ImgNumber,
ImgCategory, ImgLink. Now the field of tbl_Images.ImgCategory holds a number
(tbl_Category.CategoryID). The table Category has 2 fields, the ID (primary
Key) and the Category Name. So, when an Image is added to the Image table
the category is set to use the primary key from the category table.
However, when I output the image table data I want the
tbl_Category.CategoryName to show not the tbl_Category.CategoryID, but I
can't figure out how to join the tables so that I get that data. So far the
query I am using says that there is a mismatch on data type.
QUERY:
<cfquery name="ShowImages" datasource="#request.dsn#">
SELECT tbl_CategoryID, tbl_CategoryID, tbl_Images.*
FROM tbl_Category INNER JOIN tbl_Images ON tbl_category.CategoryID =
tbl_Images.ImgCategory</cfquery>
The query above tells me there is a mismatch data type. So, how do I get
this to work and also to output the Name of the category and not the number
for grouping by Name.
Thanks,
Kim
KimMazz Guest
-
sql join query
Hi, I have a little problem that's driving me nuts, I'm sure there's a simple solution that I'm overlooking. The problem is this (I'm giving... -
Add another join to a query
I need to add to the SELECT item "C.CATEGORY_ID" to the following query (another join?): Category_id is a column of table "blog_categories" which... -
INNER JOIN query question
I have 2 tables with the following columns (other data fields omitted for brevity): cases.caseid cases.uid profiles.uid profiles.locationid... -
SQL join query help
I have written a forum and am using the following query to search in it: $query="select topics.tid,f_messages.messid from f_messages left join... -
Query, Join on nearest
Hello, I am in a position where i need to create a query where i must join two tables on the nearest value. Imagine i have 2 tables, tbl_Trade... -
paross1 #2
Re: Inner Join Query
Please provide the exact column names and data types from BOTH tables, and
their relationships (id-id, etc.) Since you are only relating two columns
(tbl_category.CategoryID = tbl_Images.ImgCategory) it looks like these are of
different types.
Phil
paross1 Guest
-
KimMazz #3
Re: Inner Join Query
Phil
Yes, I did find that out. I had the data type on one set to autonumber since
it's the primary key and the other was set to text. Once I changed that to
number the query worked.
Thanks for responding I appreciate it.
Kim
"paross1" <webforumsuser@macromedia.com> wrote in message
news:e6mone$mch$1@forums.macromedia.com...> Please provide the exact column names and data types from BOTH tables, and
> their relationships (id-id, etc.) Since you are only relating two columns
> (tbl_category.CategoryID = tbl_Images.ImgCategory) it looks like these are
> of
> different types.
>
> Phil
>
KimMazz Guest



Reply With Quote

