想要避免选择连接查询中的特定行...请参阅说明
我有一个选择左连接查询,它向我显示最新更改的行(其时间)列名称(“字段”不应该相等)列名称(“trackid”不应该相等),以及列名称“操作应该”是“UPDATE”“,下面是我正在讨论的查询...
SELECT j1. *
FROM jos_audittrail j1
LEFT OUTER JOIN jos_audittrail j2 ON ( j1.trackid != j2.trackid
AND j1.field != j2.field
AND j1.changedone < j2.changedone )
WHERE j1.operation = 'UPDATE'
AND j2.id IS NULL
我得到的结果字段值为“lastvisitDate”或“hits”
现在在这里我不希望显示带有两个特定列的行值即“字段的值”,该值是“lastvisitDate”和“hits”
现在,如果我在上面的查询中附加条件 " AND j1.field != 'lastvistDate' AND j1.field != 'hits' " 然后我没有得到任何结果...
表结构是
jos_audittrail:
- id
- trackid
- 操作
- oldvalue
- newvalue
- table_name
- livechangedone
- (它的时间)
我希望我已经正确地给出了详细信息如果你仍然发现缺少一些东西我会尝试提供更多更好的方法...
请帮助我避免这两行与提到的“字段”值
I have a Select Left Join Query whis displays me the rows for the latest changedone(its a time) column name ("field" should not be equal) column name ("trackid" should not be equal), and column name "Operation should be "UPDATE" ", below is the query I am talking about...
SELECT j1. *
FROM jos_audittrail j1
LEFT OUTER JOIN jos_audittrail j2 ON ( j1.trackid != j2.trackid
AND j1.field != j2.field
AND j1.changedone < j2.changedone )
WHERE j1.operation = 'UPDATE'
AND j2.id IS NULL
I get the result with field value as either "lastvisitDate" or "hits"
Now here I don't want a row to be displayed with a two particular column's value i.e. "field's value" the value is "lastvisitDate" and "hits"
Now if i append the condition in the above query that
" AND j1.field != 'lastvistDate' AND j1.field != 'hits' "
then i do not get any result...
The table structure is
jos_audittrail:
- id
- trackid
- operation
- oldvalue
- newvalue
- table_name
- live
- changedone(its a time)
I hope i have given the details properly If u still find something missing I will try to provide it more better way...
Pls help me to avoid those two rows with those to mentioned value of "field"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以这种方式更改了我的选择查询,并以我需要的方式得到了结果,
感谢 Pranav 的支持...:)
I Changed My select query this way and I got the result the way I needed
Thanks Pranav For the Support... :)