none
Query to get multiple fields from one column RRS feed

  • Question

  • Hi,

    I have column called Response in EmpQueries table which holds multile fields values based on QueryID

    For Ex: If QueryID = 'EICONS' -- Response column will give "Employer to be assigned" 
    If QueryID = 'EIRCONS' - Response Column will give "Reason for Assigned" Value..

    So i need to show both these columns ("Employer to be assigned" and "Reason for Assigned" ) in my results in below query.. but as of now i am able to show only "Employer to be assigned" value by giving QueryID = 'EICONS' ...

    I am not sure how i can show both the columns .. I new to SQL programming..Below is the query which i have return.

    How can i get "Reason for Assigned" column ?

    select SD.RollNumber ,SD.Name As 'Student Name',EmpID As 'Requesting Employer',Eq.Response as 'Employer to be assigned',
    ** from EmpInfo Ei**
    ** INNER JOIN EmpQueries Eq**
    ** on Ei.OrderID = eq.OrderID**
    ** inner JOIN StudentsData SD**
    ** ON Ei.VisitID = SD.VisitID **
    ** where Category = 'CONS' and Ei.Status not in ('CANC') **
    ** and DateTime between '2017-03-23 00:00:00' and '2017-03-23 23:59:59'**
    ** and Eq.QueryID = 'EICONS'**
    Order by EmpID

    Thank you ...


    Diddi

    Wednesday, March 29, 2017 4:07 PM

All replies

  • Hello,

    Your question/requirement is not clear for me; please post table design as DDL statement, some sample data as DML and the expected result.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Wednesday, March 29, 2017 4:22 PM