1. Список говнокодов пользователя arusanov

    Всего: 1

  2. SQL / Говнокод #5979

    −851

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    select distinct bk.ID, bk.URL, bk.Date, bk.Name, bk.Description, bk.UserCreatorID from bookmarking_bookmark as bk 
    where bk.Tenant=@Tenant and bk.ID in 
    (select *  from (select b.ID  from bookmarking_bookmark as b  left join  bookmarking_bookmarktag as bt on b.ID=bt.BookmarkID left join bookmarking_tag as t  on bt.TagID=t.TagID 
    left join (select ub.BookmarkID as BookmarkID, ub.Name as UserBookmarkName,ub.Description as UserBookmarkDescription, t.Name as TagName  
    from (select * from bookmarking_userbookmark as ub where ub.UserID=@userID) as ub 
    left join bookmarking_userbookmarktag as ubt  on ub.UserBookmarkID=ubt.UserBookmarkID  
    left join bookmarking_tag as t  on ubt.TagID=t.TagID) as ub on b.ID=ub.BookmarkID 
    where  ( ( lower(b.URL) like lower(@tagNameForUrlWithoutLastSlash0) )  
    or (lower(b.Name) like lower(@tagName0) or lower(b.Name) like lower(@tagNameWithSpace0)) 
    or (lower(b.Description) like lower(@tagName0) or lower(b.Description) like lower(@tagNameWithSpace0))    
    or (lower(t.Name) like lower(@tagName0)) or (lower(t.Name)  like lower(@tagNameWithSpace0)) 
    or (lower(TagName) like lower(@tagName0)) or (lower(TagName) like lower(@tagNameWithSpace0))    
    or (lower(UserBookmarkName) like lower(@tagName0) or lower(UserBookmarkName) like lower(@tagNameWithSpace0))    
    or (lower(UserBookmarkDescription) like lower(@tagName0) or lower(UserBookmarkDescription) like lower(@tagNameWithSpace0)))  
    and b.ID in (
    select b.ID   from bookmarking_bookmark as b  left join  bookmarking_bookmarktag as bt  on b.ID=bt.BookmarkID
    left join bookmarking_tag as t    on bt.TagID=t.TagID 
    left join  (
    select ub.BookmarkID as BookmarkID, ub.Name as UserBookmarkName, ub.Description as UserBookmarkDescription, t.Name as TagName from 
    (select * from bookmarking_userbookmark as ub where ub.UserID=@userID) as ub  
    left join bookmarking_userbookmarktag as ubt on ub.UserBookmarkID=ubt.UserBookmarkID
    left join bookmarking_tag as t on ubt.TagID=t.TagID) as ub on b.ID=ub.BookmarkID
    where  (( lower(b.URL) like lower(@tagNameForUrlWithoutLastSlash1) ) or (lower(b.Name) like lower(@tagName1) or lower(b.Name) like lower(@tagNameWithSpace1)) 
    or (lower(b.Description) like lower(@tagName1) or lower(b.Description) like lower(@tagNameWithSpace1)) or (lower(t.Name) like lower(@tagName1)) 
    or (lower(t.Name)  like lower(@tagNameWithSpace1)) or (lower(TagName) like lower(@tagName1)) or (lower(TagName) like lower(@tagNameWithSpace1))  
    or (lower(UserBookmarkName) like lower(@tagName1) or lower(UserBookmarkName) like lower(@tagNameWithSpace1)) or (lower(UserBookmarkDescription)
    like lower(@tagName1) or lower(UserBookmarkDescription) like lower(@tagNameWithSpace1))) and b.ID in (
    select b.ID from bookmarking_bookmark as b left join bookmarking_bookmarktag as bt on b.ID=bt.BookmarkID left join bookmarking_tag as t on bt.TagID=t.TagID left join
    (select ub.BookmarkID as BookmarkID, ub.Name as UserBookmarkName,  ub.Description as UserBookmarkDescription, t.Name as TagName 
    from (select * from bookmarking_userbookmark as ub where ub.UserID=@userID) as ub 
    left join bookmarking_userbookmarktag as ubt on ub.UserBookmarkID=ubt.UserBookmarkID  left join bookmarking_tag as t on ubt.TagID=t.TagID) as ub on b.ID=ub.BookmarkID
    where (( lower(b.URL) like lower(@tagNameForUrlWithoutLastSlash2) ) or (lower(b.Name) like lower(@tagName2) or lower(b.Name) like lower(@tagNameWithSpace2))
    or (lower(b.Description) like lower(@tagName2) or lower(b.Description) like lower(@tagNameWithSpace2)) or (lower(t.Name) like lower(@tagName2)) or (lower(t.Name)
    like lower(@tagNameWithSpace2)) or....

    среднее время выполнения 30 секунд

    arusanov, 14 Марта 2011

    Комментарии (115)