[thelist] [SQL] SELECT Question

Joshua Olson joshua at waetech.com
Fri May 27 10:22:12 CDT 2005


> -----Original Message-----
> From: Jacques Capesius
> Sent: Thursday, May 26, 2005 3:19 PM
> 
> What I want to do is something like this.
> 
> ------------------------------------------------------------
> SELECT
> (
> 	SUBQUERY 1
> ) 
> AS 'Sales',
> (
> 	SUBQUERY 2
> ),
> 
> [Column 'Sales'] / [Column 'Quota'] AS 'Percent to Quota'
> FROM...

Depending on your database, something like this may work for you:

SELECT Sales, Quote, Sales/Quota SD 'Percent to Quota'
FROM
(
	SELECT
	(
		SUBQUERY 1
	) 
	AS 'Sales',
	(
		SUBQUERY 2
	) AS 'Quota'
)

The above syntax is equivalent to an adhoc view, for the most part.

Which database are you using?

<><><><><><><><><><>
Joshua L. Olson
WAE Tech Inc.
http://www.waetech.com/
Phone: 706.210.0168 

Monitor bandwidth usage on IIS6 in real-time:
http://www.waetech.com/services/iisbm/




More information about the thelist mailing list