[UPHPU] OT: SQL question (MSSQL)
J M
jmul.php at gmail.com
Wed Sep 6 21:39:13 MDT 2006
Do you know of any SQL techniques that takes a value (variable) sends it in
to a subquery, applies conditions with the "WHERE" part of a select
statement (in the subquery) then goes onto the next value until the entire
query is done? If you could give me some psuedo code from any rdbms that
you are familiar with, I might be able to translate it to TSQL from there
with the use of google.
I've tried the subquery method that you suggested but I got the same
results. I believe I need to be able to do a query on each charge
code....one at a time. With my limited knowledge on SQL, I'm not even sure
what functions to look for or key words to use in Books Online or using
google. I'm not even sure if the logic of SQL can toss in one charge code
at a time to a subquery.
If you aren't familiar with SQL that way, do you know of any links I could
reference?
Thanks for your help. I appreciate it.
John
On 9/6/06, Tyler Gee <geekout at gmail.com> wrote:
>
> I think with all the grouping you have going on you are going to need
> to do it with a subquery. Basically, just write a select statement
> that is getting the count values you want and then replace the sum()
> part in your statement with that. Something like:
>
> #
> SELECT 'ChargeCode' = vpb900.chg_cod_ext_id,
> [SNIP]
> 'Count' = (select statement here)
> FROM VPB900_CHG_CODE_MST vpb900 (nolock),
> [SNIP]
>
>
>
More information about the UPHPU
mailing list