Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Jokertje> Is there a sort of LIMIT or OFFSET to return the values except the LAST one?
- <thumbs> Jokertje: you could use a subquery
- <Jokertje> how would that look like
- * K3rmit (~asdf@CPE0021296828b2-CM00111ae6f860.cpe.net.cable.rogers.com) has joined #mysql
- * dudz_ (~dudz@123-243-44-131.tpgi.com.au) Quit (Remote host closed the connection)
- <adaptr> Jokertje: SELECT * FORM foo WHERE id < MAX(id)
- * cubezzz2 (~cubeman@maxhost.org) has left #mysql
- <venom00ut> Jokertje, it depends, you don't want just the last one or all the ones which have the max value?
- * JunTao2 (~asdf@CPE0021296828b2-CM00111ae6f860.cpe.net.cable.rogers.com) Quit (Ping timeout: 255 seconds)
- <venom00ut> adaptr, can you make such a query? I think is misleading, you should make an explicit subquery
- <adaptr> venom00ut: excuse me ?
- * trumpetmic (~trumpetmi@c-174-51-106-125.hsd1.co.comcast.net) has joined #mysql
- <venom00ut> SELECT * FORM foo WHERE id < (SELECT MAX(id) FROM foo)
- * KirillVlasov (~kirill@92.37.197.245) Quit (Quit: Ухожу я от вас (xchat 2.4.5 или старше))
- <adaptr> venom00ut: um. that's silly
- <venom00ut> no, that's the standard way
- <adaptr> no, it's silly
- <vegaicm> I wonder for what type of application you need all but the last one
- <venom00ut> aggregate functions should appear just in the HAVING clause
- <adaptr> wtf do you think "the standard way" is >
- <adaptr> venom00ut: I am not using any aggregation except to yield a single decision value
- <venom00ut> adaptr, try googling "sql standard"
- * trumpetmic (~trumpetmi@c-174-51-106-125.hsd1.co.comcast.net) Quit (Client Quit)
- <adaptr> venom00ut: thanks for the pedantry, but no
- <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
- * ilab_ (ilab@ancient.webfoundation.net) Quit (Quit: Lost terminal)
- * mariuscc (~mariuscc@ciobanuvicol2.iasi.rdsnet.ro) Quit (Ping timeout: 240 seconds)
- <venom00ut> adaptr, that query is not standard so probably won't work on other dbms
- <adaptr> venom00ut: why would I care about that
- <adaptr> and yes, it will. obviously
- * A1B2C3 (~cyd@37-232-183-194.adsl.perceval.be) has joined #mysql
- <adaptr> perhaps try it out on half a dozen before you spout irerelevancies
- <venom00ut> moreover it implicitly makes a subquery so it's misleading
- <adaptr> venom00ut: you're in #mysql. act accordingly
- <adaptr> venom00ut: how would you know that
- <venom00ut> adaptr, please stop to be obtuse
- * RooTX (~RooTX@adrz128.neoplus.adsl.tpnet.pl) has joined #mysql
- <adaptr> because ?
- <adaptr> you're a paragon of righteousness and clarity ?
- <venom00ut> moreover he asked to remove the last one, so most probably what he need is limit and order by
- * Cricket (~gallo@shellium/member/titan) has joined #mysql
- * albertogg (~Adium@pcsp244-74.dynamic.supercable.net.ve) has joined #mysql
- <adaptr> what you're saying is A. wrong. plain and simple. and B. not relevant to mysql
- <venom00ut> there's no need to have a paragon, you are the bottom
- * heyyo (~heyyp@83.55.205.199) has joined #mysql
- <adaptr> and who made you relevant, exactly ?
- * purefusion (~purefusio@unaffiliated/purefusion) Quit (Quit: Why don't you make like a tree, and get out of here?)
- <Jokertje> i am back, sorry
- <vegaicm> adaptr: I am sorry to say it, but ... your query doesn't work.
- <adaptr> vegaicm: that's just silly
- <Kitty-> hi adaptr
- <adaptr> oh noes, it's Kitteh!
- <venom00ut> Jokertje, it depends, you don't want just the last one or all the ones which have the max value?
- * wbooze (~user@xdsl-78-34-104-144.netcologne.de) has joined #mysql
- * mariuscc (~mariuscc@ciobanuvicol2.iasi.rdsnet.ro) has joined #mysql
- * purefusion (~purefusio@unaffiliated/purefusion) has joined #mysql
- <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
- <venom00ut> adaptr, it's true, it doesn't work neither for me
- <venom00ut> [Err] 1111 - Invalid use of group function
- * andref (~andref@luna.ksiezyc.pl) Quit (Ping timeout: 276 seconds)
- <Jokertje> would it look like this
- <Jokertje> $aGet = mysql_query("SELECT DISTINCT id FROM photos WHERE id < 0(id) ORDER BY id DESC");
- <adaptr> venom00ut: shows you how more powerful MS SQL is! ;)
- <venom00ut> adaptr, mmmh, looks like you're a loser
- <adaptr> venom00ut: yes, obviously
- <adaptr> venom00ut: buy me dinner
- <venom00ut> yes, you are, let me quote you
- * RooTX` (~RooTX@adrz128.neoplus.adsl.tpnet.pl) has joined #mysql
- * purefusion (~purefusio@unaffiliated/purefusion) Quit (Client Quit)
- <venom00ut> what you're saying is A. wrong. plain and simple. and B. not relevant to mysql
- <adaptr> venom00ut: ah, yes, that shows what YOU are
- <venom00ut> wait, I've to publish this log
- <Jokertje> im gone, working
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement