Showing posts with label attempting. Show all posts
Showing posts with label attempting. Show all posts

Saturday, February 25, 2012

Can somone crack this query?

This is a simplification of a query I'm attempting to write at the
moment. I can do it with a temp table, but I think it can be done in
one query. 15 minutes of fame to the correct answer.

3 tables:
Table Continent
================Columns==================
Columns:
ID (primary key)
Name
================Data=====================
NA,North America
SA,South America

Table Country
================Columns==================
ContinentID (foreign key)
Name
Population
================Data=====================
NA,United States,295734134
NA,Canada,32805041
SA,Brazil,186112794
SA,Peru, 27269482

Can someone come up with the query to return the country with the
lowest population in each continent, ie:
CA,Canada,32805041
SA,Peru,27269482

Need to have the country name in the query (would be very easy if you
didn't!).--BEGIN PGP SIGNED MESSAGE--
Hash: SHA1

SELECT ContinentID, Name, Population
FROM Country As C
WHERE Population = (SELECT Min(Population) FROM Country
WHERE ContinentID = C.ContinentID)
ORDER BY ContinentID, Name

Do I get a Gold Star?
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

--BEGIN PGP SIGNATURE--
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQtMcJYechKqOuFEgEQK58wCgyTJWEzJIGiiynKX9fRrHOA n2/5AAnjhF
XjBxajYEv1Afl+VAJVYY9DLI
=3lQX
--END PGP SIGNATURE--

russ wrote:
> This is a simplification of a query I'm attempting to write at the
> moment. I can do it with a temp table, but I think it can be done in
> one query. 15 minutes of fame to the correct answer.
> 3 tables:
> Table Continent
> ================Columns==================
> Columns:
> ID (primary key)
> Name
> ================Data=====================
> NA,North America
> SA,South America
> Table Country
> ================Columns==================
> ContinentID (foreign key)
> Name
> Population
> ================Data=====================
> NA,United States,295734134
> NA,Canada,32805041
> SA,Brazil,186112794
> SA,Peru, 27269482
> Can someone come up with the query to return the country with the
> lowest population in each continent, ie:
> CA,Canada,32805041
> SA,Peru,27269482
> Need to have the country name in the query (would be very easy if you
> didn't!).|||you most certainly do! correlated sub-query, ended up doing the same
myself.

thanks for your help

Thursday, February 16, 2012

Can Report Parameter Prompt be Dynamically changed?

I am attempting to write a multilingual report and would like to have
the Prompt property of a Report Parameter dynamically change. Is this
possible? Support for something like an expression would be ideal,
but I cannot seem to find where prompt supports such a concept.
Thanks,
DaveOn Dec 6, 3:59 pm, david.gab...@.swagelok.com wrote:
> I am attempting to write a multilingual report and would like to have
> the Prompt property of a Report Parameter dynamically change. Is this
> possible? Support for something like an expression would be ideal,
> but I cannot seem to find where prompt supports such a concept.
> Thanks,
> Dave
As far as I know, this functionality does not exist. One work around
would be to modify the .rdl file programmatically between the <prompt>
tags based on the language (via StreamReader, StreamWriter, etc).
Also, you might try creating a custom ASP.NET website and allow the
user to select a language from a drop-down list and then create 2
reports: each one based on a different language. Then you could show
either report based on the language selected. Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant