Mysql视图:命令不同步

时间:2015-11-19 12:55:11

标签: mysql sql mysqli

我有一个导致错误的mysql视图: 命令不同步。现在无法执行此命令。 视图已创建或更改。但是当去查看View Details时...抛出此错误。请尽快帮助。

    CREATE VIEW vw_member_information_details
    AS
    SELECT mi.*,DATE_FORMAT(minfoDOB,'%M %d, %Y')AS dateofBirth,
    (DATE_FORMAT(now(),'%Y')-DATE_FORMAT(minfoDOB,'%Y'))AS Age,
    CASE WHEN mi.minfoProfileCreatedFor='950' THEN '' ELSE ch.chName END AS profCreatedBy,
    CASE WHEN mi.minfoHeight=0 THEN 'NA' ELSE ch1.chName END AS height,
    CASE WHEN mi.minfoReligion=0 THEN 'NA' ELSE ch2.chName END AS religion,
    CASE WHEN mi.minfoMotherTounge=0 THEN 'NA' ELSE ch3.chName END AS mothertounge,
    CASE WHEN mi.minfoCommunity=0 THEN 'NA' ELSE ch4.chName END AS community,
    CASE WHEN mi.minfoNakshtra=0 THEN 'NA' ELSE ch5.chName END AS nakshatra,
    CASE WHEN mi.minfoCity=0 THEN 'NA' ELSE ch6.chName END AS city,
    CASE WHEN mi.minfoCountry=0 THEN 'NA' ELSE ch7.chName END AS country,
    CASE WHEN me.eduMaster=0 THEN 'NA' ELSE ch8.chName END AS eduMaster,
    CASE WHEN me.eduIn=0 THEN 'NA' ELSE ch9.chName END AS eduIn,
    CASE WHEN mi.minfoWorkingAs =0 THEN 'NA' ELSE ch10.chName END AS workingAs,
    CASE WHEN mi.minfoRashi=0 THEN 'NA' ELSE ch11.chName END AS rashi,
    CASE WHEN mi.minfoMaritalStatus=0 THEN 'NA' ELSE ch12.chName END AS maritalStatus,
    CASE WHEN mi.minfoManglik=0 THEN 'NA' ELSE ch13.chName END AS manglik,
    CASE WHEN mi.minfoSubCommunity='' THEN 'NA' ELSE mi.minfoSubCommunity END AS subCommunity,
    CASE WHEN mi.minfoBodyWeight=0 THEN 'NA' ELSE mi.minfoBodyWeight END AS weight,
    CASE WHEN mi.minfoBodyWeight=0 THEN 'NA' ELSE ch16.chName END AS weightIn,
    ch15.chName AS gender,
    CASE WHEN mi.minfoHealthInfo=0 THEN 'NA' ELSE ch17.chName END AS healthInfo,
    CASE WHEN mi.minfoSkinTone=0 THEN 'NA' ELSE ch18.chName END AS skinTone,
    CASE WHEN mi.minfoDisability=0 THEN 'NA' ELSE ch19.chName END AS disability,
    CASE WHEN mi.minfoBloodGroup=0 THEN 'NA' ELSE ch20.chName END AS bloodGroup,
    CASE WHEN mi.minfoGotra=0 THEN 'NA' ELSE ch21.chName END AS gotra,
    CASE WHEN mi.minfoFatherStatus=0 THEN 'NA' ELSE ch22.chName END AS fatherStatus,
    CASE WHEN mi.minfoMotherStatus=0 THEN 'NA' ELSE ch23.chName END AS motherStatus,    
    CASE WHEN mi.minfoAffluenceLevel=0 THEN 'NA' ELSE ch24.chName END AS affluenceLevel,
    CASE WHEN mi.minfoFamilyValues=0 THEN 'NA' ELSE ch25.chName END AS familyValues,
    CASE WHEN mi.minfoWorkingWith=0 THEN 'NA' ELSE ch26.chName END AS workingWith,
    CASE WHEN mi.minfoEmployerName='' THEN 'NA' ELSE mi.minfoEmployerName END AS employerName,
    CASE WHEN mi.minfoAnnualIncome=0 THEN 'NA' ELSE ch27.chName END AS annualIncome,    
    CASE WHEN mi.minfoDiet=0 THEN 'NA' ELSE ch28.chName END AS diet,
    CASE WHEN mi.minfoSmoke=0 THEN 'NA' ELSE ch29.chName END AS smoke,
    CASE WHEN mi.minfoDrink=0 THEN 'NA' ELSE ch30.chName END AS drink,

    CASE WHEN mi.minfoState=0 THEN 'NA' ELSE ch31.chName END AS state,
    CASE WHEN mi.minfoPincode=0 THEN 'NA' ELSE mi.minfoPincode END AS pincode,
    CASE WHEN mi.minfoKundali='' THEN 'NA' ELSE mi.minfoKundali END AS kundali,
    u.user_type,u.user_active,  

    CASE WHEN (SELECT memberPhoto FROM tbl_member_photo WHERE member_Id=mi.minfoId AND isProfile=1 ) IS NOT NULL THEN
    (SELECT memberPhoto FROM tbl_member_photo WHERE member_Id=mi.minfoId AND isProfile=1) ELSE '' END AS memberPhoto,

    CASE WHEN cd.cDetailContactPerson ='' THEN mi.minfoFullName ELSE cd.cDetailContactPerson END AS contactPerson,
    ch32.chName AS relationWithMember,cd.cDetailTimeCallFrom,cd.cDetailCallFromType,cd.cDetailTimeCallTo,   
    cd.cDetailCallToType,

    pp.ppAgeFrom,pp.ppAgeTo,pp.ppHeightFrom,pp.ppHeightTo,
    GROUP_CONCAT(ch33.chName SEPARATOR ', ') AS ppMaritalStatus,
    GROUP_CONCAT(ch34.chName SEPARATOR ', ') AS ppReligion,
    GROUP_CONCAT(ch35.chName SEPARATOR ', ') AS ppMotherTounge,
    GROUP_CONCAT(ch36.chName SEPARATOR ', ') AS ppCommunity,
    GROUP_CONCAT(ch37.chName SEPARATOR ', ') AS ppProfileCreatedBy,
    GROUP_CONCAT(ch38.chName SEPARATOR ', ') AS ppStateLivingIn,
    GROUP_CONCAT(ch39.chName SEPARATOR ', ') AS ppCity,
    GROUP_CONCAT(ch40.chName SEPARATOR ', ') AS ppResidencyStatus,
    GROUP_CONCAT(ch41.chName SEPARATOR ', ') AS ppCountryGrewUp,
    GROUP_CONCAT(ch42.chName SEPARATOR ', ') AS ppEducation,
    GROUP_CONCAT(ch43.chName SEPARATOR ', ') AS ppWorkingWith,
    GROUP_CONCAT(ch44.chName SEPARATOR ', ') AS ppProfessionArea,
    GROUP_CONCAT(ch45.chName SEPARATOR ', ') AS ppBodyType,
    GROUP_CONCAT(ch46.chName SEPARATOR ', ') AS ppSkinTone,
    GROUP_CONCAT(ch49.chName SEPARATOR ', ') AS ppDiet,

    ch48.chName AS ppManglik, ch50.chName AS ppSmoke,ch51.chName AS ppDrink,
    ch52.chName AS ppAnnualIncome,ch53.chName AS ppCountryLivingIn,ch54.chName AS ppDisability,
    ch55.chName AS ppHivPositive    

    FROM tbl_member_info mi    
    LEFT JOIN tbl_member_education me ON mi.minfoId=me.member_Id
    LEFT JOIN  tbl_member_contact_details cd ON mi.minfoId=cd.member_Id
    LEFT JOIN  tbl_partner_preferences pp ON mi.minfoId=pp.member_Id
    LEFT JOIN tbl_users u ON mi.minfoId=u.user_id
    LEFT JOIN tbl_choice_master ch ON ch.chId=mi.minfoProfileCreatedFor
    LEFT JOIN tbl_choice_master ch1 ON ch1.chId=mi.minfoHeight
    LEFT JOIN tbl_choice_master ch2 ON ch2.chId=mi.minfoReligion
    LEFT JOIN tbl_choice_master ch3 ON ch3.chId=mi.minfoMotherTounge
    LEFT JOIN tbl_choice_master ch4 ON ch4.chId=mi.minfoCommunity
    LEFT JOIN tbl_choice_master ch5 ON ch5.chId=mi.minfoNakshtra
    LEFT JOIN tbl_choice_master ch6 ON ch6.chId=mi.minfoCity
    LEFT JOIN tbl_choice_master ch7 ON ch7.chId=mi.minfoCountry
    LEFT JOIN tbl_choice_master ch8 ON ch8.chId=me.eduMaster
    LEFT JOIN tbl_choice_master ch9 ON ch9.chId=me.eduIn
    LEFT JOIN tbl_choice_master ch10 ON ch10.chId=mi.minfoWorkingAs                 
    LEFT JOIN tbl_choice_master ch11 ON ch11.chId=mi.minfoRashi
    LEFT JOIN tbl_choice_master ch12 ON ch12.chId=mi.minfoMaritalStatus
    LEFT JOIN tbl_choice_master ch13 ON ch13.chId=mi.minfoManglik
    LEFT JOIN tbl_choice_master ch15 ON ch15.chId=mi.minfoGender
    LEFT JOIN tbl_choice_master ch16 ON ch16.chId=mi.minfoWeightIn
    LEFT JOIN tbl_choice_master ch17 ON ch17.chId=mi.minfoHealthInfo
    LEFT JOIN tbl_choice_master ch18 ON ch18.chId=mi.minfoSkinTone
    LEFT JOIN tbl_choice_master ch19 ON ch19.chId=mi.minfoDisability
    LEFT JOIN tbl_choice_master ch20 ON ch20.chId=mi.minfoBloodGroup
    LEFT JOIN tbl_choice_master ch21 ON ch21.chId=mi.minfoGotra 
    LEFT JOIN tbl_choice_master ch22 ON ch22.chId=mi.minfoFatherStatus
    LEFT JOIN tbl_choice_master ch23 ON ch23.chId=mi.minfoMotherStatus  
    LEFT JOIN tbl_choice_master ch24 ON ch24.chId=mi.minfoAffluenceLevel
    LEFT JOIN tbl_choice_master ch25 ON ch25.chId=mi.minfoFamilyValues  
    LEFT JOIN tbl_choice_master ch26 ON ch26.chId=mi.minfoWorkingWith
    LEFT JOIN tbl_choice_master ch27 ON ch27.chId=mi.minfoAnnualIncome
    LEFT JOIN tbl_choice_master ch28 ON ch28.chId=mi.minfoDiet  
    LEFT JOIN tbl_choice_master ch29 ON ch29.chId=mi.minfoSmoke
    LEFT JOIN tbl_choice_master ch30 ON ch30.chId=mi.minfoDrink
    LEFT JOIN tbl_choice_master ch31 ON ch31.chId=mi.minfoState
    LEFT JOIN tbl_choice_master ch32 ON ch32.chId=cd.cDetailRelationWithMember

    LEFT JOIN tbl_choice_master ch33 ON pp.ppMaritalStatus LIKE CONCAT('%,',ch33.chId,',%')
    LEFT JOIN tbl_choice_master ch34 ON pp.ppReligion LIKE CONCAT('%,',ch34.chId,',%')
    LEFT JOIN tbl_choice_master ch35 ON pp.ppMotherTounge LIKE CONCAT('%,',ch35.chId,',%')
    LEFT JOIN tbl_choice_master ch36 ON pp.ppCommunity LIKE CONCAT('%,',ch36.chId,',%')
    LEFT JOIN tbl_choice_master ch37 ON pp.ppProfileCreatedBy LIKE CONCAT('%,',ch37.chId,',%')
    LEFT JOIN tbl_choice_master ch38 ON pp.ppStateLivingIn LIKE CONCAT('%,',ch38.chId,',%')
    LEFT JOIN tbl_choice_master ch39 ON pp.ppCity LIKE CONCAT('%,',ch39.chId,',%')
    LEFT JOIN tbl_choice_master ch40 ON pp.ppResidencyStatus LIKE CONCAT('%,',ch40.chId,',%')
    LEFT JOIN tbl_choice_master ch41 ON pp.ppCountryGrewUp LIKE CONCAT('%,',ch41.chId,',%')
    LEFT JOIN tbl_choice_master ch42 ON pp.ppEducation LIKE CONCAT('%,',ch42.chId,',%')
    LEFT JOIN tbl_choice_master ch43 ON pp.ppWorkingWith LIKE CONCAT('%,',ch43.chId,',%')

    LEFT JOIN tbl_choice_master ch44 ON pp.ppProfessionArea LIKE CONCAT('%,',ch44.chId,',%')
    LEFT JOIN tbl_choice_master ch45 ON pp.ppBodyType LIKE CONCAT('%,',ch45.chId,',%')
    LEFT JOIN tbl_choice_master ch46 ON pp.ppSkinTone LIKE CONCAT('%,',ch46.chId,',%')
    LEFT JOIN tbl_choice_master ch49 ON pp.ppDiet LIKE CONCAT('%,',ch49.chId,',%')

    LEFT JOIN tbl_choice_master ch48 ON ch48.chId=pp.ppManglik
    LEFT JOIN tbl_choice_master ch50 ON ch50.chId=pp.ppSmoke
    LEFT JOIN tbl_choice_master ch51 ON ch51.chId=pp.ppDrink
    LEFT JOIN tbl_choice_master ch52 ON ch52.chId=pp.ppAnnualIncome
    LEFT JOIN tbl_choice_master ch53 ON ch53.chId=pp.ppCountryLivingIn  
    LEFT JOIN tbl_choice_master ch54 ON ch54.chId=pp.ppDisability   
    LEFT JOIN tbl_choice_master ch55 ON ch55.chId=pp.ppHivPositive

    WHERE u.user_type=501 GROUP BY mi.minfoId

0 个答案:

没有答案