无论子记录是否存在,都返回父记录的SQL查询(SQL Query that returns parent records regardless if child records are present)
我需要帮助构建一个返回父记录的查询(来自Meeting表),无论子记录是否存在(来自ActionItems表)。 我能够通过LEFT JOIN执行此操作,但是一旦我添加了其他关联表(成员和类别),代码将无法正常工作。
这是我的表的结构:
我需要显示每次会议的信息
ActionItems表中的CategoryId字段可能为空,我需要显示ActioItem,即使CategoryId为空
会议可能没有与之关联的任何操作项,即使没有ActionItem,也需要返回会议记录
这是我的代码不起作用(我可能需要进行多个查询,这很好):
SELECT Members.FirtName , Members.LastName , Meeting.Notes , Meeting.Location , ActionItems.Details , ActionItems.CompleteByDate , Category.Name FROM Members INNER JOIN (Meetings LEFT JOIN (ActionItems INNER JOIN Category.Id = ActionItems.CategoryId) ON Meeting.Id = ActionItems.MeetingId) ON Members.Id = Meeting.MemberId;
谢谢!
I need help constructing a query that returns parent records (from the Meeting table), regardless if the child records are present (from the ActionItems table). I was able to do this with a LEFT JOIN, but once I added other associated tables (Members and Category), the code wouldn't work.
Here is the structure of my tables:
I need to display information from each Meeting
The CategoryId field might be blank in the ActionItems Table, I need to show ActioItem even if CategoryId is blank
Meeting might not have any Action Items associated with it, need to return Meeting records even if there are no ActionItems
Here's my code that doesn't work (I may need to make multiple queries which is fine):
SELECT Members.FirtName , Members.LastName , Meeting.Notes , Meeting.Location , ActionItems.Details , ActionItems.CompleteByDate , Category.Name FROM Members INNER JOIN (Meetings LEFT JOIN (ActionItems INNER JOIN Category.Id = ActionItems.CategoryId) ON Meeting.Id = ActionItems.MeetingId) ON Members.Id = Meeting.MemberId;
Thanks!
原文:https://stackoverflow.com/questions/50257261
最满意答案
使用
AppointmentItem.GetRecurrencePattern().GetOccurrence()
检索要修改的特定重复实例AppointmentItem.GetRecurrencePattern().GetOccurrence()
- 返回与该事件对应的AppointmentItem
,修改它并保存(AppointmentItem.Save
)。Retrieve the particular recurrence instance that you want to modify using
AppointmentItem.GetRecurrencePattern().GetOccurrence()
- it returnsAppointmentItem
corresponding to that occurrence, modify it, and save (AppointmentItem.Save
).
相关问答
更多-
为什么需要每次出现的开始日期? 没有结束日期的约会怎么样? Outlook对象模型仅允许按其开始日期(RecurrencePattern.GetOccurrence)检索重复,因此您可以选择基于重复属性在代码中显式计算开始日期,也可以使用Redemption - RDORecurrencePattern允许检索事件按日期(就像Outlook)或整数索引 - http://www.dimastr.com/redemption/RDORecurrencePattern.htm 。 可以使用RDOSession. ...
-
AppointmentItem的.Display函数有一个参数。 设置为“true”,我假设是显示表格。 “真实”实际上是被激活的模态选项。 从Display()函数中删除“True”解决了此问题。 The .Display function of the AppointmentItem takes one parameter. It was set to "true" which I assumed was to display the form. The "true" was actually the ...
-
需要访问Outlook Application对象,因为您自己的Application没有合适的CreateItem方法: 这些方面的东西: Imports Microsoft.Office.Interop .... Private Sub AddAppointment() '--- Check if Outlook is already up and running If Process.GetProcessesByName("outlook").Count > 0 Then ...
-
使用AppointmentItem.GetRecurrencePattern().GetOccurrence()检索要修改的特定重复实例AppointmentItem.GetRecurrencePattern().GetOccurrence() - 返回与该事件对应的AppointmentItem ,修改它并保存( AppointmentItem.Save )。 Retrieve the particular recurrence instance that you want to modify using ...
-
当然,使用RecurrencePattern.Exceptions集合 - 请参阅http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.exceptions.aspx Sure, use the RecurrencePattern.Exceptions collection - see http://msdn.microsoft.com/en-us/library/microsoft.office.interop.o ...
-
Interop Outlook - 从另一个邮箱发送约会(Interop Outlook - Sending Appointment from another mailbox)[2022-06-02]
目前尚不清楚您是在单个邮件配置文件中设置了两个帐户还是单独的配置文件。 AppointmentItem类的SendUsingAccount属性允许设置一个Account对象,该对象表示将在其下发送AppointmentItem的帐户。 因此,SendUsingAccount属性可用于指定在调用Send方法时应用于发送AppointmentItem的帐户。 我认为这不是你想要的。 无论如何,您可以使用Store类的GetDefaultFolder方法,该方法返回一个Folder对象,该对象表示存储中的默认文件 ... -
Outlook将PST文件中的互联预约项目复制到其他日历(Outlook interop copy appointment items from PST file to other calendar)[2023-09-28]
Outlook在决定是否可以复制或移动特定项目时尝试运行其业务逻辑,并调用处理更新/删除通知,甚至可能运行表单脚本(如果使用自定义表单)。 如果使用Redemption是一个选项,请尝试以下内容 - Redemption不会尝试使用。 RDOSession Session = new RDOSession(); Session.MAPIOBJECT = Application.Session.MAPIOBJECT; RDOMail rItem = (RDOMail)Session.GetRDOO ... -
Outlook筛选项 - 获取一周范围内的所有定期约会(Outlook Filter Items - Get all recurring appointments in a week range)[2022-10-27]
你必须使用重复模式把它放在你的循环中: if (item.IsRecurring) { Microsoft.Office.Interop.Outlook.RecurrencePattern rp = item.GetRecurrencePattern(); DateTime first = new DateTime(2011, 11, 7, item.Start.Hour, item.Start.Minute, 0); ... -
通过遵循此处找到的信息,我能够使用“yyyy-MM-dd HH:mm”作为toString调用的格式字符串。 希望这可以帮助。 By following the information found here, I was able to get it to work using "yyyy-MM-dd HH:mm" as the format string for the toString call. Hope this helps.
-
尝试使用AppointmentItem.Copy而不是Application.CreateItem。 Try to use AppointmentItem.Copy instead of Application.CreateItem.