August 23, 2016 at 8:09 am
I'm learning SSRS and SQL and currently I need a single value for a default value in a user prompt.
The recommended way to get this value is with another DataSet in SSRS.
But I don't know how to make a single query return a single value from a row, while using other columns to derive that row.
For example if I have 3 columns, firstName, lastName, employeeID, and I want to sort on the combined names and return just that resulting ID - how can I do that?
So how would I change this into something that just returns the employeeID of the TOP row:
SELECT [firstName] + N' ' + [lastName] as fullname
,[employeeID]
FROM [playzone].[dbo].[NamesTest]
ORDER BY [lastName] ASC
Thanks
August 23, 2016 at 1:57 pm
Here you go:
August 23, 2016 at 2:36 pm
Thanks for responding.
I knew of TOP. But I didn't want one row. Which is why I wrote
return a single value from a row
.
Anyways the SSRS dialogs for setting that parameter from a query expected a single value and gave me the option of just selecting that value/column from the resulting data (one row). Which TOP(1) provided.
So I didn't need to make the query return a single value as I'd thought. A single row sufficed.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply