Ask a Question related to Coldfusion Database Access, Design and Development.
-
ehaemmerle #1
Select a list of items into an aliased field when doinga select
OK I know this is going to sound weird, but I'm wondering if this is possible.
I have a task table. (tblTask) These tasks can be assigned to multiple people
from tblEmployee. There is a lookup table called tblEmployeeTask which contains
nothing but Task ID's and Employee ID's so that the same task can be assigned
to multiple people. Now I am doing a select statment to display the tasks and
feeding that query into a display module. The display module expects one query
and will display the columns from the query returned. It will ONLY accept one
query so I need all the fields to be returned in the one query. Now since the
task can be assigned to multiple people, I need a way in my original query to
get a comma delimeted list (or a list seperated by carriage returns for
display) containing the first and last names of the people the task is assigned
to. So for example, the query would return: vchrTaskSubject: 'Foo'
dtmStartDate: '03/18/2005' dtmEndDate: '03/30/2005' AssignedTo: 'Fred
Flinstone, Barney Rubble, Pete Wackadoo' So I just need a way int eh query to
select that list into a return variable. I hope this made sense. THANKS
ehaemmerle Guest
-
Select multiple items from a dropdown
I want an ASP page with a dropdown and a simple button. Every time the user chooses an item from the dropdown and clicks on the button i want that... -
URL for example that allows users to select various items from list to print?
I remember seeing a couple of examples where the user could check several records for printing. I'm interested in the checking process so was... -
SELECT to find items NOT common in a table
SELECT * FROM PArts WHERE PKID NOT IN(SELECT FKDEVICE FROM INVENTORY) Also you can use EXISTS (check books online) "Michael Ingram (TAC)"... -
SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
Following is my stored procedure. If I take the DISTINCT out then everything works fine. BUT I need the distinct because it returns duplicate... -
SELECT DISTINCT + ORDER BY gives ERROR 145: ORDER BY items mustappear in the select list if SELECT DISTINCT is specified.
Dan, You should be able to do this: SELECT Id, FaxID, ReceivedTime, Pages FROM ( SELECT DISTINCT .Id AS Id, -
paross1 #2
Re: Select a list of items into an aliased field whendoing a select
Just ORDER BY task in your query, then in your CFOUTPUT you would use the GROUP
= attribute, something like this:
<cfoutput query="query_name" group="task>
#task#<br>
<cfoutput>
#Employee#<br>
</cfoutput>
</cfoutput>
Phil
paross1 Guest
-
ehaemmerle #3
Re: Select a list of items into an aliased field whendoing a select
Thanks for the reply. Sorry I wasnt clear. I am actually feeding the query into
a display module. I cannot edit the display module directly as it is a module
that we are using that will take a query and automatically display the columns
and values from the given query so all our query results have a consistent look
and feel. So thats why I have to have all my data IN the original query. I
cannot mess with the actual oputput on the display side as the module handles
that.
ehaemmerle Guest
-
paross1 #4
Re: Select a list of items into an aliased field whendoing a select
Sorry, I was editing my original post by adding a query when you replied. The
best that you can do is get you list of tasks and employees, but the task name
will show up in each row with the employee name. You have to use the gymnastics
in the output to list the task only once for every employee name.
<cfquery name="query_name" datasource="dsn">
SELECT t.task, e.Employee
FROM tblTask t, tblEmployee e, tblEmployeeTask et
WHERE t.taskID = et.taskID
AND e.employeeID = et.employeeID
ORDER BY t.task
</cfquery>
paross1 Guest



Reply With Quote

