当前位置:网站首页>Get max value of a bit column - get max value of a bit column

Get max value of a bit column - get max value of a bit column

2022-06-24 18:18:00 javail

problem :

I have a SELECT request with 'inner join' in the joined table is a column with bit type. I have a connection table with “ Internal connection ” Of SELECT The request is a column of bit type .

I want to select 1 if in the joined table is at most one value with 1. If it is not the case the value will be 0. If there is at most one value in the connection table , I want to choose 1. If this is not the case , Then the value will be 0.

So If I have: So if I have :

PERSID | NAME1      |  Toto2      |  Titi3      |  Tata

And the second table And a second table

PERSID | BOOL1      |  01      |  02      |  02      |  1

I would like to have for result I want results

Toto -> 0Titi -> 1Tata -> 0

I try this: I'll try this :

SELECT      sur.*    ,MAX(bo.BOOL)        FROM SURNAME sur                  INNER JOIN BOOL bo    ON bo.IDPERS = sur.IDPERS

But MAX is not available on BIT column.. So how can I do that? however MAX stay BIT Not available on column .. So what should I do ?

Thanks, thank you ,


Solution :

Reference resources : https://stackoom.com/en/question/jKbY
原网站

版权声明
本文为[javail]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211403119529.html