|
|
|
|
Yogs,
what about
SELECT * FROM
(SELECT "Created at","Application ID","Enquirer name","Enquirer Email","Date of enquiry","How did you come to know about OCNLondon",
"Name of organisation","UKPRN (if applicable)","Website","Do you already deliver Accredited Qualifications",
"Organisation type","Created by","Changed by","Changed at"
FROM
( SELECT FieldTitle,FieldValue
FROM UserDefinedFields F
JOIN UserDefinedData D
ON F.UserDefinedFieldId = D.UserDefinedFieldId
WHERE ModuleId = 2042
) as S
PIVOT (MAX(FieldValue)
FOR FieldTitle IN ("Application ID","Enquirer name","Enquirer Email","Date of enquiry","How did you come to know about OCNLondon",
"Name of organisation","UKPRN (if applicable)","Website","Do you already deliver Accredited Qualifications",
"Organisation type","Created by","Created at","Changed by","Changed at")) AS a
JOIN
(SELECT "Created at","Application ID","Enquirer Name","Enquirer Email","Enquirer Role","Main Address Line","Address Line 2",
"Delivering OCN London qualification","Gaining OCN London accreditation for existing course(s)","
How many learners would you expect to register in twelve month period",
"Do you have funding in place to support delivery of the qualification",
"If Yes What is the source of your funding","Does your organisation have (please select all that apply)",
"Do your tutors / assessors have qualifications in teaching & assessment",
"Do any assessors have qualifications / experience in internal verification","
DCELLS (Dept of Children / Education / Lifelong Learning and Skills)",
"ESTYN (Welsh Inspectorate)","CCEA (Council for the Curriculum / Examinations and Assessment)",
"Created by","Changed by","Changed at"
FROM
( SELECT FieldTitle,FieldValue
FROM UserDefinedFields F
JOIN UserDefinedData D
ON F.UserDefinedFieldId = D.UserDefinedFieldId
WHERE ModuleId = 2074
) as S
PIVOT (MAX(FieldValue)
FOR FieldTitle IN ("Application ID","Enquirer Name","Enquirer Email","Enquirer Role","Main Address Line","Address Line 2",
"Delivering OCN London qualification","Gaining OCN London accreditation for existing course(s)","
How many learners would you expect to register in twelve month period",
"Do you have funding in place to support delivery of the qualification",
"If Yes What is the source of your funding","Does your organisation have (please select all that apply)",
"Do your tutors / assessors have qualifications in teaching & assessment",
"Do any assessors have qualifications / experience in internal verification","
DCELLS (Dept of Children / Education / Lifelong Learning and Skills)",
"ESTYN (Welsh Inspectorate)","CCEA (Council for the Curriculum / Examinations and Assessment)",
"Created by","Created at","Changed by","Changed at")) as b ON a.[Application ID]= b.[Application ID]
|
|
|
|
| |
|
|
|
Joined: 4/11/2014
Posts: 9
|
|
|
Hi Sab,
Thanks for your post.
I tried but it gives me below error on "ON" clause.
I tried Inner Join as well but same error.
Any thoughts?
|
|
|
|
| |
|
|
|
there were two ) missing:
SELECT * FROM
(SELECT [Application ID],
[Enquirer name],
[Enquirer Email],
[Date of enquiry],
[How did you come to know about OCNLondon],
[Name of organisation],
[UKPRN (if applicable)],
[Website],
[Do you already deliver Accredited Qualifications],
[Organisation type],
[Created at],
[Created by],
[Changed by],
[Changed at]
FROM ( SELECT FieldTitle,FieldValue
FROM UserDefinedFields F
JOIN UserDefinedData D ON F.UserDefinedFieldId = D.UserDefinedFieldId
WHERE ModuleId = 2042) AS S
PIVOT (MAX(FieldValue)
FOR FieldTitle IN ("Application ID","Enquirer name","Enquirer Email","Date of enquiry","How did you come to know about OCNLondon",
"Name of organisation","UKPRN (if applicable)","Website","Do you already deliver Accredited Qualifications",
"Organisation type","Created by","Created at","Changed by","Changed at"))) AS a
JOIN
(SELECT [Application ID],
[Enquirer Name],
[Enquirer Email],
[Enquirer Role],
[Main Address Line],
[Address Line 2],
[Delivering OCN London qualification],
[Gaining OCN London accreditation for existing course(s)],
[How many learners would you expect to register in twelve month period],
[Do you have funding in place to support delivery of the qualification],
[If Yes What is the source of your funding","Does your organisation have (please select all that apply)],
[Do your tutors / assessors have qualifications in teaching & assessment],
[Do any assessors have qualifications / experience in internal verification],
[DCELLS (Dept of Children / Education / Lifelong Learning and Skills)],
[ESTYN (Welsh Inspectorate)","CCEA (Council for the Curriculum / Examinations and Assessment)],
[Created at],
[Created by],
[Changed by],
[Changed at]
FROM ( SELECT FieldTitle,FieldValue
FROM UserDefinedFields F
JOIN UserDefinedData D ON F.UserDefinedFieldId = D.UserDefinedFieldId
WHERE ModuleId = 2074) AS S
PIVOT (MAX(FieldValue)
FOR FieldTitle IN ("Application ID","Enquirer Name","Enquirer Email","Enquirer Role","Main Address Line","Address Line 2",
"Delivering OCN London qualification","Gaining OCN London accreditation for existing course(s)","
How many learners would you expect to register in twelve month period",
"Do you have funding in place to support delivery of the qualification",
"If Yes What is the source of your funding","Does your organisation have (please select all that apply)",
"Do your tutors / assessors have qualifications in teaching & assessment",
"Do any assessors have qualifications / experience in internal verification","
DCELLS (Dept of Children / Education / Lifelong Learning and Skills)",
"ESTYN (Welsh Inspectorate)","CCEA (Council for the Curriculum / Examinations and Assessment)",
"Created by","Created at","Changed by","Changed at"))) AS b
ON a.[Application ID]= b.[Application ID]
|
|
|
|
| |
|
|
|
Joined: 4/11/2014
Posts: 9
|
|
|
I tried your suggestions,
but with little luck . I am getting error.
but when I try.
When i remove ")" from each of the query all red lines disappears.
error is "the multi-part "b.Application ID"identifier could not be bound"
May be it's not referencing it properly to the right table just a through.
|
|
|
|
| |
|
|
|
are you able to run both subqueries individually?
|
|
|
|
| |