复杂查询 [英] Complex Query

查看:111
本文介绍了复杂查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多数民众赞成我的情况:

我有三张桌子:

1.主桌: tblDB_Daten

菲尔兹:[ID],[标题],[发布商位置],[发布商名称],[ISBN]

2.包含查询信息的表格: tblMark_PV

字段:[ISBN],[PubLocSingle],[PubLocCombin],[PubName]

3.查询结果表: tblDB_PV

字段:[ID_Daten],[PV]

结果是结果表中的字段[tblDB_PV]。[PV]。应填写文字PV。如果

1.字段[tblDB_Daten]。主表中的[ISBN]包含[tblMark_PV]。[ISBN]来自query-table

2。字段[tblDB_Daten]。主表中的[PublisherLocation]包含[tblMark_PV]。[PubLocSingle]来自query-table

另外

字段[tblDB_Daten]。主表中的[PublisherName]包含[tblMark_PV]。[PubName]来自query-table


我已经尝试了几天来生成一个有效的SQL代码(使用UPDATE和LEFT JOIN)但失败了。所以我现在要求一些帮助。

Thats my situation:
I have three tables:
1. Main table: tblDB_Daten
Fields: [ID], [Title], [PublisherLocation], [PublisherName], [ISBN]
2. Table containing the information for the query: tblMark_PV
Fields: [ISBN], [PubLocSingle], [PubLocCombin], [PubName]
3. Table for the result of query: tblDB_PV
Fields: [ID_Daten], [PV]

As a result the fields [tblDB_PV].[PV] in the "result-table" should be filled with the text "PV" in case
1. Field [tblDB_Daten].[ISBN] in Main-table contains [tblMark_PV].[ISBN] from the "query-table"
2. Field [tblDB_Daten].[PublisherLocation] in Main-table contains [tblMark_PV].[PubLocSingle] from the "query-table"
3. Field [tblDB_Daten].[PublisherLocation] in Main-table contains [tblMark_PV].[PubLocCombin] from the "query-table"
and additionally
Field [tblDB_Daten].[PublisherName] in Main-table contains [tblMark_PV].[PubName] from the "query-table"

I have tried for days to generate a working SQL-Code (using UPDATE and LEFT JOIN) but failed. So I am asking for some help now.

推荐答案

你当前的查询是什么样的?
What does your current query look like?


" query-table" 对[ tblDB_PV ]的引用?


一般来说,你已经包含了所有重要信息,但我很遗憾地说它没有明确的意义(至少对我来说不是这样)。我希望翻译中丢失了一些东西,所以我不得不说你做得很好,但是如果你能说得更清楚那就非常有帮助。


As JForbes说,它也会非常有用,如果你要以SQL的方式发布到目前为止的内容,请允许我们更多地帮助你。


我可以说你需要至少两个表之间的JOIN。如果没有更好地理解你想要做什么,那么这些JOIN是如何工作的我还不清楚。
Is the "query-table" a reference to [tblDB_PV]?

In general you''ve included all the important information, but I''m sorry to say that it doesn''t make clear sense (Certainly not to me at least). I expect something''s been lost in translation so I have to say you''ve done a good job, but if you could make it clearer that would be very helpful.

As JForbes says, it would also be very helpful, and allow us to help you more, if you were to post in what you have got to so far in the way of your SQL.

I can say that you''ll need JOINs between at least two tables. How those JOINs would work I''m not clear on yet without a better understanding of what you''re trying to do.


回复的好处!

我开始新的试用:
tblDB_Daten 包含一组数据,每周从外部源导入一次。从该数据集中,应提取以下信息:位于巴伐利亚州的出版商的ISBN是否是巴伐利亚州的出版商所在地。由于位置并非总是不同,因此需要额外的查询:位置与发布商名称的组合。

查询的相关信息位于 tblMark_PV

我将查询结果写在一个单独的表 tblDB_PV 中。

还有一个包含来自 tblDB_Daten 的数据的查询表,希望来自 tblDB_PV 的数据。

As用户应该选择标准(ISBN,位置等),我认为这个单独的表tblDB_PV 可能会有所帮助。

到现在为止,我失败了第一个查询步骤。
Thnks for the replies!
I start a new trial:
tblDB_Daten contains a set of data, that will be imported from an external source once a week. From this dataset the following information should be extracted: Is the ISBN from a publisher located in Bavaria, is the publishers location in Bavaria. As the location is not always distinct, an additional query is necessary: Location im combination with publishers name.
The relevant information for the query is in tblMark_PV.
I indend to write the query result in a seperate table tblDB_PV.
There also is a query-table with the data from tblDB_Daten and hopefully the data from tblDB_PV.
As the user should have the choice of the criterias (ISBN, location ... etc), I thoght this seperate table tblDB_PV might be helpfull.
By now I fail even with the first query-step.
展开 | 选择 | Wrap | 行号


这篇关于复杂查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆