Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. <Jokertje> Is there a sort of LIMIT or OFFSET to return the values except the LAST one?
  2. <thumbs> Jokertje: you could use a subquery
  3. <Jokertje> how would that look like
  4. * K3rmit (~asdf@CPE0021296828b2-CM00111ae6f860.cpe.net.cable.rogers.com) has joined #mysql
  5. * dudz_ (~dudz@123-243-44-131.tpgi.com.au) Quit (Remote host closed the connection)
  6. <adaptr> Jokertje: SELECT * FORM foo WHERE id < MAX(id)
  7. * cubezzz2 (~cubeman@maxhost.org) has left #mysql
  8. <venom00ut> Jokertje, it depends, you don't want just the last one or all the ones which have the max value?
  9. * JunTao2 (~asdf@CPE0021296828b2-CM00111ae6f860.cpe.net.cable.rogers.com) Quit (Ping timeout: 255 seconds)
  10. <venom00ut> adaptr, can you make such a query? I think is misleading, you should make an explicit subquery
  11. <adaptr> venom00ut: excuse me ?
  12. * trumpetmic (~trumpetmi@c-174-51-106-125.hsd1.co.comcast.net) has joined #mysql
  13. <venom00ut> SELECT * FORM foo WHERE id < (SELECT MAX(id) FROM foo)
  14. * KirillVlasov (~kirill@92.37.197.245) Quit (Quit: Ухожу я от вас (xchat 2.4.5 или старше))
  15. <adaptr> venom00ut: um. that's silly
  16. <venom00ut> no, that's the standard way
  17. <adaptr> no, it's silly
  18. <vegaicm> I wonder for what type of application you need all but the last one
  19. <venom00ut> aggregate functions should appear just in the HAVING clause
  20. <adaptr> wtf do you think "the standard way" is >
  21. <adaptr> venom00ut: I am not using any aggregation except to yield a single decision value
  22. <venom00ut> adaptr, try googling "sql standard"
  23. * trumpetmic (~trumpetmi@c-174-51-106-125.hsd1.co.comcast.net) Quit (Client Quit)
  24. <adaptr> venom00ut: thanks for the pedantry, but no
  25. <vegaicm> Jokertje: I wouldn't do it on server side, but client side. It is easier to just ignore a row on the client instead of doing some odd filtering on the server
  26. * ilab_ (ilab@ancient.webfoundation.net) Quit (Quit: Lost terminal)
  27. * mariuscc (~mariuscc@ciobanuvicol2.iasi.rdsnet.ro) Quit (Ping timeout: 240 seconds)
  28. <venom00ut> adaptr, that query is not standard so probably won't work on other dbms
  29. <adaptr> venom00ut: why would I care about that
  30. <adaptr> and yes, it will. obviously
  31. * A1B2C3 (~cyd@37-232-183-194.adsl.perceval.be) has joined #mysql
  32. <adaptr> perhaps try it out on half a dozen before you spout irerelevancies
  33. <venom00ut> moreover it implicitly makes a subquery so it's misleading
  34. <adaptr> venom00ut: you're in #mysql. act accordingly
  35. <adaptr> venom00ut: how would you know that
  36. <venom00ut> adaptr, please stop to be obtuse
  37. * RooTX (~RooTX@adrz128.neoplus.adsl.tpnet.pl) has joined #mysql
  38. <adaptr> because ?
  39. <adaptr> you're a paragon of righteousness and clarity ?
  40. <venom00ut> moreover he asked to remove the last one, so most probably what he need is limit and order by
  41. * Cricket (~gallo@shellium/member/titan) has joined #mysql
  42. * albertogg (~Adium@pcsp244-74.dynamic.supercable.net.ve) has joined #mysql
  43. <adaptr> what you're saying is A. wrong. plain and simple. and B. not relevant to mysql
  44. <venom00ut> there's no need to have a paragon, you are the bottom
  45. * heyyo (~heyyp@83.55.205.199) has joined #mysql
  46. <adaptr> and who made you relevant, exactly ?
  47. * purefusion (~purefusio@unaffiliated/purefusion) Quit (Quit: Why don't you make like a tree, and get out of here?)
  48. <Jokertje> i am back, sorry
  49. <vegaicm> adaptr: I am sorry to say it, but ... your query doesn't work.
  50. <adaptr> vegaicm: that's just silly
  51. <Kitty-> hi adaptr
  52. <adaptr> oh noes, it's Kitteh!
  53. <venom00ut> Jokertje, it depends, you don't want just the last one or all the ones which have the max value?
  54. * wbooze (~user@xdsl-78-34-104-144.netcologne.de) has joined #mysql
  55. * mariuscc (~mariuscc@ciobanuvicol2.iasi.rdsnet.ro) has joined #mysql
  56. * purefusion (~purefusio@unaffiliated/purefusion) has joined #mysql
  57. <Jokertje> vegaicm: i want to fetch my photos to my archive, except the last one because the last one has no news attached to it
  58. <venom00ut> adaptr, it's true, it doesn't work neither for me
  59. <venom00ut> [Err] 1111 - Invalid use of group function
  60. * andref (~andref@luna.ksiezyc.pl) Quit (Ping timeout: 276 seconds)
  61. <Jokertje> would it look like this
  62. <Jokertje> $aGet = mysql_query("SELECT DISTINCT id FROM photos WHERE id < 0(id) ORDER BY id DESC");
  63. <adaptr> venom00ut: shows you how more powerful MS SQL is! ;)
  64. <venom00ut> adaptr, mmmh, looks like you're a loser
  65. <adaptr> venom00ut: yes, obviously
  66. <adaptr> venom00ut: buy me dinner
  67. <venom00ut> yes, you are, let me quote you
  68. * RooTX` (~RooTX@adrz128.neoplus.adsl.tpnet.pl) has joined #mysql
  69. * purefusion (~purefusio@unaffiliated/purefusion) Quit (Client Quit)
  70. <venom00ut> what you're saying is A. wrong. plain and simple. and B. not relevant to mysql
  71. <adaptr> venom00ut: ah, yes, that shows what YOU are
  72. <venom00ut> wait, I've to publish this log
  73. <Jokertje> im gone, working
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement