Les Mizzell wrote:
> 
> I've got a table of Office Branches. Some of them are MAIN BRANCHES (value
> "main" under "sub_branch" in table).
> Others are SUB BRANCHES and would have the branch_ID of the main branch
> listed in the "sub_branch" cell.
> 
> So, I need a self join to get this to work, correct?  Can't get the syntax
> just right....
> 
> Table: BRANCHES
> ---------------
> ID
> branch_name
> branch_ID
> sub_branch

SELECT    main.branch_name AS mainBranch, sub.branchname AS subBranch
FROM      BRANCHES main INNER JOIN BRANCHES sub
               ON (sub.branch_ID = main.ID)
ORDER BY  main.branch_name, sub.branchname

Then do the formatting in a cfoutput with a group.

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to