#mysql - Sun 13 May 2007 between 00:15 and 00:30

NY Lost Funds



turbanoChamelion -> join #php
can i select an time between two fields?
these two fields are DATETIME
erpsyes
BETWEEN :p
turbano:p
i search for that
i will*
swampfoxHere's a query question: I'd like to know how to construct a query to get, say, 2 records before and after a given record. For example, if I have the id of 49, I'd like to get the two rows preceding it and the two rows following it. But the id numbers aren't necessarily contiguous. So they might be 47, 48, 49, 51, 54 or 42, 43, 49, 50, 61 . date field, but I thought it might be easier
Ignore that last part, sorry. :)
Something like "SELECT [id AND ALSO 2 ROWS ON EITHER SIDE] from table where id=49;"
spackestnot sure if I should ask here or in #ubuntu, but I can't get mysql reinstalled
turbanoahm, try somethin like
swampfoxthough I don't think "AND ALSO 2 ROWS ON EITHER SIDE" is valid SQL. :)
spackestsomewhere along the way, it got shutdown in a bad way, I think my innodb stuff corrupted and I can't get it started again
turbanoSELECT * FROM table WHERE id < 49 OR id > 51
spackestI have tried wiping everything mysql I could find and doing an apt-get install mysql-server-5.0 and am having no luck
also tried 5.1 with same results
swampfoxturbano: No, I can do that once I know what the id is. But I have to construct the second query by hand. Here's what I'm doing.
I have records that include the date they were entered (these are items in an inventory). When items leave, their records are deleted.
spackestit ends up stalled on Stopping MySQL database server: mysqld.
and stalls on starting as well
swampfoxSo I have gaps in the remaining records, though I can order them by date.
spackestI can telnet to 3306 and there's something listening there, but I can't connect
any ideas?
swampfoxI want a query that says "Return, as a single result set, 5 records sorted by date, where the middle one is id=3354" or whatever.
I could do "Return 5 where the FIRST one is id=3354" using ORDER BY and LIMIT. But I don't know how to do one that puts the row I'm specifying in the middle of the result set.
turbano: Does that make more sense?
turbanoahm, i didn't get, you want to get the MIDDLE row?
swampfoxBasically, I want the SQL equivalent of grep's -C option, which shows not only the line you're searching for, but also a few context lines on either side of it.
turbanoahhh
swampfoxturbano: OK, right now I do this query: SELECT id, date_added FROM inventory where id=3354;
turbanoyou want your query to return the specific result, and then returns two lines above, and two lines after?
swampfoxturbano: Exactly.
turbanohum, let me think
dimHi all.. I need to pull a list of all products from my DB.. problem is the products' info is scatted throughout 3 tables.. PRODUCTS table - products_id, products_quantity, products_model, products_image, products_price, manufacturers_id fields, and join them with PRODUCTS_DESCRIPTION table - products_id, products_alternate_name, products_name, products_description fields, and also with MANUFACTURERS table - manufacturers_id, manufacturers_name. Can
swampfoxAs it is, it's pretty easy to do the two lines after it as a single query (SELECT id, date_added FROM inventory where id > 3354 ORDER by id ASC limit 2)
turbanoyou could do something like where id > 3354 - 2
but it could get bug
if you deleted the id 3353

Page: 2 9 16 23 

IrcArchive

NY Lost Funds