1

我咨询它是:

update enfermedades
    join
pacientes ON pacientes.id = enfermedades.paciente_id
    join
consultas ON consultas.paciente_id = pacientes.id
    join
signos_sintomas ON signos_sintomas.consulta_id = consultas.id 

set 
    enfermedades.diabetes = 1,
    bmi = signos_sintomas.imc_kg_m2,
    promedio_presion_sistolica = ((pa_de_pie_izquierda + pa_sentado_izquierda) / 2),
    microalbuminuria = 0,
    macroalbuminuria = 0,
    fibrilacion = 0,
    ecv = 0,
    duracion = 15,
    antiht = 0,
    diabetes = 0
where
    enfermedades.riesgo_diabetes_mellitus = 0
        and pacientes.situacion = 0
        and riesgo_diabetes_dano_organo_blanco = 0
        and signos_sintomas.created in (select 
            signos_sintomas.created,consultas.created
        from
            signos_sintomas
                join
            consultas ON consultas.id = signos_sintomas.consulta_id
                join
            pacientes ON pacientes.id = consultas.paciente_id
        where
            pacientes.id = pacientes.id
        order by signos_sintomas.created , consultas.created desc);

错误 1241 (21000):操作数应包含 1 列

作为咨询,但创建的列按降序排列

4

2 回答 2

1

您在IN返回多个列的子句中使用子选择。这样的子选择只能返回列,用于IN()比较:

and signos_sintomas.created in (select 
            signos_sintomas.created,consultas.created
                    ^^^--field #1       ^---field #2
        from

如果您返回多个列,则数据库服务器无法知道应该使用哪个列进行IN()比较。

于 2013-04-30T17:19:48.353 回答
0

改变这个

   and signos_sintomas.created in (select 
        signos_sintomas.created,consultas.created

   and signos_sintomas.created in (select 
        signos_sintomas.created

你只能选择一列,而不是两列。

于 2013-04-30T17:19:33.547 回答