| Author |
Topic  |
|
|
DvlprWun
Starting Member
USA
2 Posts |
Posted - 12/10/2012 : 01:03:07
|
I'm not as good as I used to be with T-SQL seeing as to how I mainly do Front End nowadays, but I'm trying to get back into SQL and the other parts of the N-tier. I'm making my first attempt at writing an Orchard CMS module and came up with this. It works, but I'm sure it's not the most efficient way to do it. Can someone help me out here?
select top(1)oBody.ContentItemRecord_id, oBody.Text, oRoute.Title from oCMS__Common_BodyPartRecord as oBody, oCMS__Routable_RoutePartRecord as oRoute where oBody.ContentItemRecord_id in (Select top(1) Id from oCMS__Common_CommonPartRecord where Container_id is not null order by ModifiedUtc desc)
AND oRoute.ContentItemRecord_id in (Select top(1) Id from oCMS__Common_CommonPartRecord where Container_id is not null order by ModifiedUtc desc) order by oBody.Text desc
Thanks for reading!
Killer Coding Ninja Monkeys do Exist... |
|
|
bandi
Flowing Fount of Yak Knowledge
India
1451 Posts |
Posted - 12/10/2012 : 01:23:48
|
select top(1)oBody.ContentItemRecord_id, oBody.Text, oRoute.Title from oCMS__Common_BodyPartRecord as oBody JOIN oCMS__Routable_RoutePartRecord as oRoute ON oBody.ContentItemRecord_id = oRoute.ContentItemRecord_id where oBody.ContentItemRecord_id = (Select top(1) Id from oCMS__Common_CommonPartRecord where Container_id is not null order by ModifiedUtc desc) ORDER BY oBody.text DESC
-- Chandu |
 |
|
|
DvlprWun
Starting Member
USA
2 Posts |
Posted - 12/10/2012 : 01:45:15
|
Thanks! That returns the same results.
With that being said, I'm guessing that this is also the most efficient way to do this query:
select idTbl.TagsPartRecord_Id, idTbl.TagRecord_Id, Tags.TagName from oCMS__Orchard_Tags_ContentTagRecord as idTbl join oCMS__Orchard_Tags_TagRecord as Tags on idTbl.TagRecord_Id = Tags.Id where idTbl.TagsPartRecord_Id = 701 order by idTbl.id desc
Killer Coding Ninja Monkeys do Exist... |
Edited by - DvlprWun on 12/10/2012 01:45:52 |
 |
|
| |
Topic  |
|