BETWEEN, IN, , .... not using index with floats

2008-05-16 Thread Nacho Garcia
Hi, im working with google maps and im and trying to do this, but i cant make a good query of it. I want to select elements between a given latitude and longitude from this table: *CREATE TABLE `images` (* *`id_img` bigint(20) unsigned NOT NULL auto_increment,** **`filename` char(50) NOT

JOIN / NOT JOIN differences

2008-04-16 Thread Nacho Garcia
hi, i have this table *TABLE friends: *id_usr INT id_friend INT and i have a query in which i return friends from a given user and data related to each of them stored in some other tables. So i do this: SELECT F.id_friend, M.status, P.firstname, P.lastname, IF( UNIX_TIMESTAMP( ) -

help with DB design / query please !

2008-04-08 Thread Nacho Garcia
hello, im trying to make a DB for a message system. the best way i have made is this: *TABLE conversations* (informacion de cada conversacion) . i*d_conversation (bigint) count(smallint) updated every time a new message is

how to use index with order by here

2008-03-15 Thread Nacho Garcia
Hi, im having troubles with one query, hope someone can help. on this table: messages: id_fromint(10) id_toint(10) textvarchar(1000) time with index on id_form and id_to i want to get messages sent from one user to another and vice versa order by time. let say we want to search

help with query

2008-03-06 Thread Nacho Garcia
Hi, im having a lot of trouble with one query, i hope someone could give me a hand with this, i would be really grateful these are the tables: TABLE friends id_usr INT id_friend INT with INDEX on (id_usr,id_friend) TABLE status id_usr INT lastConnection (other irrelevant info) with INDEX

unnormalize db here is more efficient?

2008-03-04 Thread Nacho Garcia
Hi, i hope this is the right place for this basic question. i have a table like this: TABLE elements `id_element` INT UNSIGNED NOT NULL , `name` VARCHAR(100), `date` DATE ... and other table with the comments of every element. TABLE elements_comments `id_element` INT UNSIGNED NOT NULL ,

triggers sintax error with IF

2008-02-16 Thread Nacho Garcia
Hi, im struggling with triggers but i can make this works because of bad sintax, i hope someone can give me a hand CREATE TRIGGER trigger_actualize AFTER INSERT ON usuarios_imgvid FOR EACH ROW IF NEW.type=IMG THEN UPDATE users_status E SET images=images+1 WHERE E.id_usr =