Ask a Question related to Coldfusion Database Access, Design and Development.
-
Conti #1
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 has in common
the column "entry_id"
SELECT
A.ENTRY_ID, A.TITLE, B.UNAME, B.ENTRY_DATE, B.COMMENT_ID
FROM BLOG_ENTRIES A INNER JOIN BLOG_COMMENTS B ON A.ENTRY_ID=B.ENTRY_ID
AND A.BLOG_ID=B.BLOG_ID
WHERE
A.BLOG_ID=<cfqueryparam cfsqltype="cf_sql_integer"
value="#arguments.blog_id#">
ORDER BY B.ENTRY_DATE DESC
Thank You
ContiW
Conti 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... -
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... -
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: Add another join to a query
Yup.
SELECT
A.ENTRY_ID, A.TITLE, B.UNAME, B.ENTRY_DATE, B.COMMENT_ID, C.CATEGORY_ID
FROM BLOG_ENTRIES A
INNER JOIN BLOG_COMMENTS B ON A.ENTRY_ID=B.ENTRY_ID
AND A.BLOG_ID=B.BLOG_ID
INNER JOIN BLOG_CATEGORIES C ON A.ENTRY_ID=C.ENTRY_ID
WHERE
A.BLOG_ID=<cfqueryparam cfsqltype="cf_sql_integer"value="#arguments.blog_i d#">
ORDER BY B.ENTRY_DATE DESC
Phil
paross1 Guest
-
Conti #3
Re: Add another join to a query
Thank You paross1. Unfortunately it does not work yet.
Tablename is correct columnName ant type also is correct.
The errorMsg returned is
Error Executing Database Query.
Syntax error (missing operator) in query expression ''.
Thanks for helping.
ContiW
Conti Guest
-
JMGibson3 #4
Re: Add another join to a query
When adding joins Access (damn microsoft) requires parentheses around the
higher join(s). Try:
FROM (BLOG_ENTRIES A
INNER JOIN BLOG_COMMENTS B ON A.ENTRY_ID=B.ENTRY_ID
AND A.BLOG_ID=B.BLOG_ID)
INNER JOIN BLOG_CATEGORIES C ON A.ENTRY_ID=C.ENTRY_ID
JMGibson3 Guest
-
Conti #5
Re: Add another join to a query
That was it !
ThankYou JMGibson3
You have a good source of info. Share?
Have a nice week.
WalterConti
Conti Guest
-
paross1 #6
Re: Add another join to a query
Sorry, you didn't say that it was Access. Yeah, the parentheses requirement makes Access just that much more fun for query writing! Just glad that you didn't need an outer join.
Phil :)
paross1 Guest
-
Conti #7
Re: Add another join to a query
I didn't. Sorry Phil.
I have Fry's a couple of blocks away and I have got a book.
See, "outher joins" ... FUN!
WalterConti
Conti Guest



Reply With Quote

