samples table
id, A, B 1, 1, 1 2, 1, 2 3, 1, 3 4, 1, 3 5, 2, 1
For tables like the ones above,
I would like to write SQL that returns true if B contains 2, or false if not.
Response Example
A,contains 1, true 2, false
How can I write SQL that satisfies the above?
(From comments)
How to determine if a valueappears in a GROUP BY group may be helpful.
SELECTA, IF(SUM(B=2), 'true', 'false') AS contents FROM samples GROUP BY;
590 Scrap text information after the "View More" button when searching in the Yahoo! News search window
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
1022 In Java servlet, when SHA-256 sends WW-Authenticate header for digest authentication, the client does not return the result.
619 Uncaught (inpromise) Error on Electron: An object could not be cloned
881 /usr/bin/google-chrome:symbol lookup error:/usr/bin/google-chrome: undefined symbol:gbm_bo_get_modifier
© 2024 OneMinuteCode. All rights reserved.