简体   繁体   English

如何从parse.com中的多个表中检索数据

[英]How to retrieve data from more than one table in parse.com

I put my data in 3 tables(Links, Images and PDF) 我将数据放在3个表格中(链接,图像和PDF)

each table has columns(university, faculty, grade, and description,...) 每个表都有列(大学,教师,年级和描述,...)

I want to retrieve description column in the 3 tables. 我想检索3个表中的描述列。

where university, faculty, and grade equal to certain values. 大学,教职员工和年级等于某些值的地方。

and sort them with creation date. 并按创建日期对它们进行排序。

how can I perform that query in parse? 如何在解析中执行该查询?

I'm not familiar with Android, but I'm pretty sure Parse does not support "Join" in the way a SQL database does. 我不熟悉Android,但是我很确定Parse不像SQL数据库那样支持“ Join”。 You could nest the queries, performing the next one in the previous one's completion block. 您可以嵌套查询,在上一个查询的完成代码块中执行下一个查询。

However, if you regularly want to get data from those 3 tables, I'd suggest you make it 1 table instead, with a column "Content" instead of Link/Img/PDF. 但是,如果您经常要从这3个表中获取数据,建议您将其改为1个表,并使用“内容”列而不是Link / Img / PDF。 Images and PDFs would probably be stored as PFFiles anyway, and you can put link as either its own string column or putting it in a file. 无论如何,图像和PDF可能都将存储为PFFiles,您可以将链接作为其自己的字符串列放置,也可以将其放置在文件中。 You could also add a column "type" if you want to be able to query a specific type, or just keep track of which columns contains which data. 如果希望查询特定类型,也可以添加“类型”列,或者仅跟踪哪些列包含哪些数据。

Then you could query the "Content" class, on the keys you want. 然后,您可以在所需的键上查询“ Content”类。

I think this link might help you https://parse.com/docs/js/guide#relations and it is quite simple and nicely explained . 我认为此链接可能会为您提供帮助https://parse.com/docs/js/guide#relations ,它非常简单并得到了很好的解释。 You can't do it directly in the database, though. 但是,您不能直接在数据库中执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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