Hi all
I have the following query:
SELECT top 1 dbo.zISSHAREHOLDERS.HOLDERID AS 'AccountNo', dbo.zISFUND.FUNDID as 'FundCode', dbo.zISFUND.FUNDNAME as 'FundName', dbo.zISNAVS.NAV AS 'FundPrice', dbo.zISHOLDINGS.SUMORIGSHARES as 'Units', dbo.zISHOLDINGS.CURRENCY as 'Currency', /*CONVERT(NUMERIC, */dbo.zISNAVS.NAV * dbo.zISHOLDINGS.SUMORIGSHARES/*)*/ AS 'MarketValue', dbo.zISSHAREHOLDERS.HOLDERNAME as 'FirstName', dbo.zISNAVS.NAVDATE as 'DATE', dbo.zISSALESPEOPLE.CONTACTNAME as 'ConsultName'
FROM
dbo.zISFUND INNER JOIN dbo.zISNAVS
ON
dbo.zISFUND.FUNDID /*Fund Code*/ = dbo.zISNAVS.FUNDID
INNER JOIN dbo.zISHOLDINGS
ON
dbo.zISFUND.FUNDID = dbo.zISHOLDINGS.FUNDID
INNER JOIN dbo.zISSHAREHOLDERS
ON
dbo.zISSHAREHOLDERS.HOLDERID = dbo.zISHOLDINGS.HOLDERID
LEFT JOIN dbo.zISSALESPEOPLE
ON
dbo.zISSHAREHOLDERS.RPID LIKE dbo.zISSALESPEOPLE.RPID
WHERE
( dbo.zISSHAREHOLDERS.HOLDERID LIKE '24301'
AND dbo.zISNAVS.NAVDATE <= GETDATE())
GROUP BY
dbo.zISNAVS.NAVDATE,
dbo.zISSHAREHOLDERS.HOLDERID,
dbo.zISSHAREHOLDERS.HOLDERNAME,
dbo.zISFUND.FUNDID,
dbo.zISFUND.FUNDNAME,
dbo.zISNAVS.NAV,
dbo.zISHOLDINGS.SUMORIGSHARES,
dbo.zISHOLDINGS.CURRENCY,
dbo.zISSALESPEOPLE.CONTACTNAME
/*ORDER BY
dbo.ISNAVS.NAVDATE*/
The moment I comment out the Order By clause, it comes up with the following error:
Server: Msg 107, Level 16, State 2, Line 1
The column prefix 'dbo.ISNAVS' does not match with a table name or alias name used in the query.
Can someone help me with this please? My SP skills are unfortunately still quite unrefined
Thanks a mill
Craftor
I have the following query:
SELECT top 1 dbo.zISSHAREHOLDERS.HOLDERID AS 'AccountNo', dbo.zISFUND.FUNDID as 'FundCode', dbo.zISFUND.FUNDNAME as 'FundName', dbo.zISNAVS.NAV AS 'FundPrice', dbo.zISHOLDINGS.SUMORIGSHARES as 'Units', dbo.zISHOLDINGS.CURRENCY as 'Currency', /*CONVERT(NUMERIC, */dbo.zISNAVS.NAV * dbo.zISHOLDINGS.SUMORIGSHARES/*)*/ AS 'MarketValue', dbo.zISSHAREHOLDERS.HOLDERNAME as 'FirstName', dbo.zISNAVS.NAVDATE as 'DATE', dbo.zISSALESPEOPLE.CONTACTNAME as 'ConsultName'
FROM
dbo.zISFUND INNER JOIN dbo.zISNAVS
ON
dbo.zISFUND.FUNDID /*Fund Code*/ = dbo.zISNAVS.FUNDID
INNER JOIN dbo.zISHOLDINGS
ON
dbo.zISFUND.FUNDID = dbo.zISHOLDINGS.FUNDID
INNER JOIN dbo.zISSHAREHOLDERS
ON
dbo.zISSHAREHOLDERS.HOLDERID = dbo.zISHOLDINGS.HOLDERID
LEFT JOIN dbo.zISSALESPEOPLE
ON
dbo.zISSHAREHOLDERS.RPID LIKE dbo.zISSALESPEOPLE.RPID
WHERE
( dbo.zISSHAREHOLDERS.HOLDERID LIKE '24301'
AND dbo.zISNAVS.NAVDATE <= GETDATE())
GROUP BY
dbo.zISNAVS.NAVDATE,
dbo.zISSHAREHOLDERS.HOLDERID,
dbo.zISSHAREHOLDERS.HOLDERNAME,
dbo.zISFUND.FUNDID,
dbo.zISFUND.FUNDNAME,
dbo.zISNAVS.NAV,
dbo.zISHOLDINGS.SUMORIGSHARES,
dbo.zISHOLDINGS.CURRENCY,
dbo.zISSALESPEOPLE.CONTACTNAME
/*ORDER BY
dbo.ISNAVS.NAVDATE*/
The moment I comment out the Order By clause, it comes up with the following error:
Server: Msg 107, Level 16, State 2, Line 1
The column prefix 'dbo.ISNAVS' does not match with a table name or alias name used in the query.
Can someone help me with this please? My SP skills are unfortunately still quite unrefined
Thanks a mill
Craftor