简体   繁体   中英

An expression of non-boolean type specified in a context where a condition is expected, near WHERE

I getting this error on the SQL code below, please help:

SELECT emissaogrd.dataEmissao, grd_dados.grd, documento.numero, emissaogrd.revDoc, recebimento.nome, grd_dados.usuariogrd 
FROM documento 
JOIN grd_dados 
JOIN emissaogrd 
JOIN recebimento  
WHERE emissaogrd.idgrd = grd_dados.grd 
    AND emissaogrd.idDoc = documento.id 
    AND emissaogrd.idgrd = recebimento.grdId 
ON recebimento.entregue='0' 
ORDER BY grd_dados.grd DESC, documento.numero;

An expression of non-boolean type specified in a context where a condition is expected, near WHERE

You're mixing old-style and new-style joins. Should be something like:

SELECT emissaogrd.dataEmissao, grd_dados.grd, documento.numero
    , emissaogrd.revDoc, recebimento.nome, grd_dados.usuariogrd 
FROM documento 
JOIN emissaogrd
    ON emissaogrd.idDoc = documento.id  
JOIN grd_dados 
    ON emissaogrd.idgrd = grd_dados.grd 
JOIN recebimento  
    ON emissaogrd.idgrd = recebimento.grdId 
WHERE recebimento.entregue = '0' 
ORDER BY grd_dados.grd DESC, documento.numero;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM