Hi,

I have a table like that:

Id | Day1 | Day2 | Day3 | ...

Trough Id, I can select the row.
Now, I don't know the Day demand, so I want to fetch the specific cell with a variable, like that:

Regist.id = 1 and Regist.variable

The ideia is selec entire column with a variable, then select a specific cell with Id, that is known.
Anu suggestions?



John John wrote:

Hi,

I have a table like that:

Id | Day1 | Day2 | Day3 | ...

Trough Id, I can select the row.
Now, I don't know the Day demand, so I want to fetch the specific cell with a variable, like that:

Regist.id = 1 and Regist.variable

The ideia is selec entire column with a variable, then select a specific cell with Id, that is known.
Anu suggestions?



Hello John


One question does this process need to be done in query or can be done after you fetch all 31 days for that id?


Like you can do a select to return that specific id and the day based on the variable you pass:


select table.id, @day

from table

where table.id = @id


@day is a variable that in the input parameter is something like this:

if(variable = 1,"table.day1","")+

if(variable = 2,"table.day2","")+

if(variable = 3,"table.day3","")...


But i do not know if this is what you want