var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: How to get the count of records on this query?
I need the number of records returned by this query:
Unfortunately, simply wrapping it in count(): `select count(distinct(M_TRADENUMB)) ...' does not work...
select distinct(M_TRADENUMB) from DM_RSK_CR_PS_R_REP where M_Z_DAYOFRUN='FIRST RUN' HAVING M_MX_REF_JOB=max(M_MX_REF_JOB);
The only way we found so far is via a subquery -- figure out the max(M_MX_REF_JOB) first:
but I dislike the subqueries...
select COUNT(DISTINCT(M_TRADENUMB)) from DM_RSK_CR_PS_R_REP WHERE
M_MX_REF_JOB = (SELECT MAX(M_MX_REF_JOB) FROM DM_RSK_CR_PS_R_REP WHERE M_Z_DAYOFRUN = 'FIRST RUN');
Can this be done while avoiding the subqueries? Am I right disliking them, or is the alternative I'm struggling to come up with just as hard for the server to run?
I'm not sure if you'll like this any better but it should be efficeint(ish)
PS if you highlight code and then press the # button it will format it like above which is easier to read.
select distinct(M_TRADENUMB) as trdnum
where M_Z_DAYOFRUN='FIRST RUN'