I would usually place the Query at the top of the HTML page and then just
place the output in the select area.

example:

This goes above header--->
<cfquery name="categorylisting" datasource="business">
SELECT Category
FROM tbl_category
</cfquery>


This is my select form statement--->
Category</FONT>:<SELECT NAME="Type">
<cfoutput query="categorylisting"><OPTION selected
>#Category#</OPTION></cfoutput>
</SELECT>

Seems to work very good for me in many places, also that way if the query
fails it stops the page and not half way through.

Thanks,
Robert


----- Original Message -----
From: "Dick Applebaum" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 07, 2000 5:30 AM
Subject: Re: Query within a select


> It is done within the SQL query itself, before the select is
> generated by the program...
>
>
> Something like
>
>    <CFQUERY  NAME=MyQuery...>
>
>     SELECT
>              Salesman.Name        AS SName,
>            , Salesan. SalesmanID  AS SID
>            , Vendor.Name          AS VName
>
>     FROM
>              Salesman
>            , Vendor
>
>     WHERE
>              Salesman.SalesmanID = Vendor.SalesmanID
>
>    </CFQUERY
>
>
>    <SELECT....>
>    <CFOUPUT QUERY=MyQuery>
>      <OPTION VALUE=#SID#>#Vname#: #SName#
>    </CFOUTPUT
>    </SELECT>
>
> This is one of the basic SQL functions, called a join.
>
> You should get a good book on SQL or review an online tutorial such as:
>
>    http://w3.one.net/~jhoffman/sqltut.htm
>
> HTH
>
> Dick
>
>
> At 1:03 AM -0400 7/7/2000, Olson, Kelly wrote:
> >Is something like this possible:
> >
> >   <SELECT NAME="ScenarioDetailID" SIZE="7">
> >   <CFOUTPUT QUERY="GetCatagoryLIST">
> >   <option value=#ScenarioDetailID#> #ScenarioID# <CFOUTPUT
> >QUERY="GetCompany">#CompanyName# </CFOUTPUT>
> >   </CFOUTPUT>
> >   </SELECT>
> >
> >Or better yet, how could something like this be done, where you may wany
> >to display a field not in the same table as the table which a select
> >list is being built?
> >
> >
>
>---------------------------------------------------------------------------
---
> >Archives: http://www.mail-archive.com/[email protected]/
> >To Unsubscribe visit
> >http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_tal
> >k or send a message to [EMAIL PROTECTED] with
> >'unsubscribe' in the body.
>
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to