April 10, 2007 at 12:22 am
Hi,
i have the following query on which i need help.i want to use left and substring as iam doing in query 2.Both queries are the same .I need to know how can you use CAST with left and substring in query 1
Query 1
SELECT
CAST(M.[School Type]as varchar(55))
FROM
[MAC Calculation$] M
LEFT JOIN Audit_Project_MAC_Calculation MAC
ON MAC.MSBA_ID = M.[Project #]
WHERE
MAC.MSBA_ID IS NULL
Query 2
select
left (M.[School Type],1) as test , substring (M.[School Type],3,13)as id
FROM
[MAC Calculation$] M
LEFT JOIN Audit_Project_MAC_Calculation MAC
ON MAC.MSBA_ID = M.[Project #]
WHERE
MAC.MSBA_ID IS NULL
April 10, 2007 at 1:25 am
select left (cast(M.[School Type] as varchar(55)), 1) as test , substring (cast(M.[School Type] as varchar(55)), 3, 13) as id
FROM
[MAC Calculation$] as M
LEFT JOIN Audit_Project_MAC_Calculation as MAC
ON MAC.MSBA_ID = M.[Project #]
WHERE
MAC.MSBA_ID IS NULL
N 56°04'39.16"
E 12°55'05.25"
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply