需要帮助来创建选择语句 [英] Need help to create select statement
本文介绍了需要帮助来创建选择语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2张桌子
puf:id_farm,dataora,cod,nume,tip,id(key)
iep:id_farm,dataora,cod,nume,tip,id(key)
在puf中,我有:
i have 2 tables
puf : id_farm,dataora,cod,nume,tip,id(key)
iep : id_farm,dataora,cod,nume,tip,id(key)
in puf i have :
'500','2010-10-10','1','nume1','tip1','1'
'500','2010-10-10','2','nume2','tip2','2'
'500','2010-10-10','3','nume3','tip3','3'
'500','2010-10-10','4','nume4','tip4','4'
'500','2010-10-10','5','nume5','tip5','5'
我具有:
'500','2010-10-11','1','q','tip1','1'
'500','2010-10-11','2','z','tip2','2'
'500','2010-10-11','3','i','tip3','3'
'500','2010-10-12','1','q','1','4'
'500','2010-10-13','2','z','2','5'
我需要的是一个选择项,该选择项将根据给定的数据返回此日期
对于2010-10-10:
What i need is a select that will return this dates based on data given
for 2010-10-10 :
'500','2010-10-10','1','nume1','tip1','1'
'500','2010-10-10','2','nume2','tip2','2'
'500','2010-10-10','3','nume3','tip3','3'
'500','2010-10-10','4','nume4','tip4','4'
'500','2010-10-10','5','nume5','tip5','5'
:
'500','2010-10-11','1','q','tip1','1'
'500','2010-10-11','2','z','tip2','2'
'500','2010-10-11','3','i','tip3','3'
'500','2010-10-10','4','nume4','tip4','4'
'500','2010-10-10','5','nume5','tip5','5'
:
'500','2010-10-11','1','q','tip1','1'
'500','2010-10-11','2','z','tip2','2'
'500','2010-10-11','3','i','tip3','3'
'500','2010-10-12','1','q','1','4'
'500','2010-10-10','5','nume5','tip5','5'
:
'500','2010-10-11','1','q','tip1','1'
'500','2010-10-11','2','z','tip2','2'
'500','2010-10-11','3','i','tip3','3'
'500','2010-10-12','1','q','1','4'
'500','2010-10-13','2','z','2','5'
选择什么才能达到这个目的?
谢谢
[edit]删除了SHOUTING,添加了代码块-OriginalGriff [/edit]
What is the select that will do this trick ?
Thank you
[edit]SHOUTING removed, Code block added - OriginalGriff[/edit]
推荐答案
首先,您对主键和外键的问题不完整(您没有提到哪一个是主要的,哪个是外国的.
如果您没有为该表构建外键,只需为第二个表构建新的FK,然后代表该调用使用select语句并提供日期作为条件即可.
有关更多详细信息,请单击 主键 [此处的外键. [ ^ ]
Firstly, your question is uncomplete about primary key and foreign key(You did''nt mentioned it which one is primary and which one is foreign).
If you didn''t built a foreign key for the table just build a new FK for the 2nd table then on behalf of that call what you want by using select statement and providing date as a condition.
For further details click on primary key[^] and foreign key here.[^]
这篇关于需要帮助来创建选择语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文