[Solved] Data content could not be loaded / Single value expected

Creating tables and queries
Post Reply
FDB
Posts: 15
Joined: Mon Oct 16, 2023 3:36 pm

[Solved] Data content could not be loaded / Single value expected

Post by FDB »

Open Office 4.1.14 - BASE
OSX 10.14.6 - Mojave

Upon using an view for a simple table, I get get the message "The data content could not be loaded / Single value expected in statement [SELECT * FROM "v1T1"]"

Table T1 :
Screenshot 2023-10-17 at 14.32.06.png
Screenshot 2023-10-17 at 14.32.06.png (55.32 KiB) Viewed 6470 times
Contents of T1 :
Screenshot 2023-10-17 at 14.32.52.png
Screenshot 2023-10-17 at 14.32.52.png (103.83 KiB) Viewed 6470 times
I want to select the records grouped by ORG and having the latest date in a view:
View v1T1:

Code: Select all

SELECT "ID", "NAME", "VALUE" 
FROM "T1"
WHERE "DATE" = (
	SELECT MAX("DATE")
	FROM "T1"
	GROUP BY "ORG"
)
The syntax of the code is OK, but when using the view I get :
Error :
The data could note be loaded
Error:
SQL Status: 21000
Error code: -17
Single value expected in statement [SELECT * FROM "v1T1"]

Anyone an idea what I am doing wrong ?

Q2 : where does the statement [SELECT * FROM "v1T1"] come from ?

advTHANKSance
Last edited by Hagar Delest on Tue Oct 17, 2023 6:30 pm, edited 1 time in total.
Reason: tagged solved.
OpenOffice 4.1.14
OSX 10.14.6 (Mojave)
FJCC
Moderator
Posts: 9459
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: The data content could not be loaded.- Single value expected

Post by FJCC »

The sub query

Code: Select all

SELECT MAX("DATE")
	FROM "T1"
	GROUP BY "ORG"

will return four rows. I think you can't use "DATE" = in the full query and you should use "DATE" IN

Code: Select all

SELECT "ID", "NAME", "VALUE" 
FROM "T1"
WHERE "DATE" IN (
	SELECT MAX("DATE")
	FROM "T1"
	GROUP BY "ORG"
)
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FDB
Posts: 15
Joined: Mon Oct 16, 2023 3:36 pm

Re: The data content could not be loaded.- Single value expected

Post by FDB »

Thanks a lot -
I am an old style programmer (FORTRAN etc) and not that familiar with databases ...
OpenOffice 4.1.14
OSX 10.14.6 (Mojave)
Post Reply