Portal Engine
Version 2.x > Portal Engine > SQL Statement Drop Down List View modes: 
User avatar
Member
Member
boodapotamus.com - 10/25/2007 4:08:31 AM
   
SQL Statement Drop Down List
I have looked but haven't found any examples of using a sql statement to populate a drop down list. I have a basic working understanding of sql queries. Any examples would be appreciated. The following is the end goal.

SELECT DISTINCT AgentName FROM custom_Agent

User avatar
Member
Member
info@kearnytech.com - 10/27/2007 4:42:48 AM
   
RE:SQL Statement Drop Down List
Your SQL Statement needs to return results in name/value pairs. I.e. your statement will need to select two columns one that will be used for the selected text (the name) and one that will be used for the selected value. And there is nothing saying that you couldn't return the same column for both, but you do need to repeat the column.

-- Simple Example
SELECT Code, Display FROM MyCodeTable

-- Using the same column for both display and value
SELECT Code as Value, Code as Name FROM MyCodeTable