Ask a Question related to Coldfusion Database Access, Design and Development.
-
DettCom #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), SUM(appl.requested) AS requested,
SUM(appl.recommend) AS recommend, SUM(appl.awarded) AS awarded, agency.agency
AS agency
from appl inner join agency on appl.ag_id = agency.ag_id
where appl.fy = '#URL.fy#'
AND agency.fy = '#URL.fy#'
AND appl.applicatio IS NOT NULL
AND appl.ho_id = '#URL.ho_id#'
AND agency.ho_id = '#URL.ho_id#'
GROUP BY appl.ag_id, agency.agency
ORDER BY appl.ag_id
In the appl table, there is a field called of_id which is a 5 char value and I
need to get the last digit which can be 1-9 which I need to cross reference
with another table to get the value's title.
This is what I was trying to do.....
select DISTINCT(appl.ag_id), SUM(appl.requested) AS requested,
grant_type.grant_type_shortcode,
SUM(appl.recommend) AS recommend, SUM(appl.awarded) AS awarded, agency.agency
AS agency
from type inner join appl on type.type_officecode on SUBSTRING(appl.of_id, 3,
4) inner join agency on appl.ag_id = agency.ag_id
where appl.fy = '#URL.fy#'
AND agency.fy = '#URL.fy#'
AND appl.applicatio IS NOT NULL
AND appl.ho_id = '#URL.ho_id#'
AND agency.ho_id = '#URL.ho_id#'
GROUP BY appl.ag_id, agency.agency
ORDER BY appl.ag_id
The problem is that with some combinations it removes the distinct process.
Thanks for any suggestion.
DettCom Guest
-
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... -
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... -
joining 3 tables?
helooo... i have 3 tables -Recipes, Ingredients and Products. Recipes table: RecipeID -PK Ingredients table: IngredientID -PK... -
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... -
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. ...



Reply With Quote

