Guest User

Untitled

a guest
Apr 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. SELECT
  2. idclient,
  3. id,
  4. name,
  5. iditemtype,
  6. price
  7. FROM items
  8. WHERE LOWER(name) LIKE '%' || LOWER(xdb_access.cnv(in_find) || '%')
  9. AND isVisible = 1
  10. AND xdb_access.equalsDateMinute(sysdate, isonline) <= t_time_online
  11. AND idclient != in_idclient
  12. GROUP BY idclient
  13.  
  14. select * from
  15. (
  16. SELECT
  17. idclient,
  18. id,
  19. name,
  20. iditemtype,
  21. price,
  22. row_number() over (partition by idclient order by idclient) rn
  23. FROM items
  24. WHERE LOWER(name) LIKE '%' || LOWER(xdb_access.cnv(in_find) || '%')
  25. AND isVisible = 1
  26. AND xdb_access.equalsDateMinute(sysdate, isonline) <= t_time_online
  27. AND idclient != in_idclient
  28. GROUP BY idclient
  29. )
  30. where rn = 1
  31.  
  32. select * from
  33. (
  34. SELECT
  35. idclient,
  36. id,
  37. name,
  38. iditemtype,
  39. price,
  40. row_number() over (partition by idclient order by idclient, id, name,
  41. iditemtype, price) rn
  42. FROM items
  43. WHERE LOWER(name) LIKE '%' || LOWER(xdb_access.cnv(in_find) || '%')
  44. AND isVisible = 1
  45. AND xdb_access.equalsDateMinute(sysdate, isonline) <= t_time_online
  46. AND idclient != in_idclient
  47.  
  48. )
  49. where rn = 1
Add Comment
Please, Sign In to add comment