Ask Your Question
0

How the ANY function works in Base?

asked 2015-07-23 02:23:18 +0100

mrmister gravatar image

Hi, I'd need a bit of help about the ANY function in LibreOffice Base.

Would someone please, help me a bit with this, with a simple example of code?

I know how to use EVERY, SOME, ALL... but I don't have seen examples from ANY yet.

Would someone help me with this please?

A simple code example would be really helpful.

Cheers

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2015-07-23 06:08:02 +0100

doug gravatar image

There are of examples in other forums, suggesting the ANY function is similar to IN and EXISTS and can be used in similar circumstances. ANY returns true on the first matched row, ALL returns false on the first non-match. Here is an example:

SELECT *
FROM "Tbl1"
WHERE "Col1" = ANY(SELECT 'str' FROM `Tbl2`)

The direct MySQL connector does not seem to allow the syntax, although MySQL does.

The syntax > ALL(SELECT Col1... is used as a synonym for > (SELECT MAX(Col1 ... with reference to numeric columns.

(if this answers your question, please accept the answer by clicking the check (image description) to the left)

edit flag offensive delete link more
0

answered 2015-07-23 15:16:03 +0100

mrmister gravatar image

Hi doug, as always, you provide amazing examples. Thanks for your help, I really appreciate that. Just a question, may I see a simple a screenshot from Tb11, just to understand a bit the data inside the table and what is on Col1... what is on str and also what is on tbl2 As I see... seems to be you can use ANY only in subqueries, right? Cheers

edit flag offensive delete link more

Comments

To test without putting a lot of time into design, I mostly used arbitrary data, I'm not sure screen shots would help much. The query SELECT 'str' FROM "Tbl2" literally returns the text 'str' for every row in "Tbl2". This would be easier if the Base or its connectors were more accommodating of things like SELECT 'str1' AS "a" UNION SELECT 'str2' AS "a", but those return errors. Tbl1 would need to have a row with the text 'str' to make that have effect. ALL is more for numerics.

doug gravatar imagedoug ( 2015-07-23 18:58:08 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-07-23 02:23:18 +0100

Seen: 99 times

Last updated: Jul 23 '15