bubblegum.anarchy
Members-
Posts
526 -
Joined
-
Last visited
Never
Everything posted by bubblegum.anarchy
-
The main difference is the supported date range - TIMESTAMP is more appropriate for storing current values used in all inserts and updates like a creation and modification timestamp, the range is from `1970-01-01 00:00:00` till partway though the yeay 2037 (according to the mysql manual). DATETIME supports dates ranging from `1000-01-01 00:00:00` to `9999-12-31 23:59:59` and is more appropriate for anniversary dates, especially those prior to 1970. TIMESTAMP values are also automatically set to the current date and time if no value is provided or a NULL value is assigned.
-
how do i determine if mysql is there in my university server
bubblegum.anarchy replied to joy83's topic in MySQL Help
Even if there is mysql access more likely then not there will also be authentication requirements in accessing the database, find out on Monday. -
The GROUP BY value is what identifies each unique group of records - maybe mapParentID
-
[SOLVED] search db table for word and display that entire row
bubblegum.anarchy replied to bradkenyon's topic in MySQL Help
WHERE $token IN (q1, q2, q3...) may be more appropriate. -
Confirm that the queries used on the webpage are what is slowing down the page load time by performing each query via a query browser, you may find that a particular query is slower than others and can be optimized in some way... oh and run an optimize/analyze on the database tables.
-
FYI - UNION performs a distinct by default.
-
What is the purpose of s.event in the subquery SELECT?
-
Yes, a stored procedure is like a php code block... look here for lots of useful information: http://dev.mysql.com/doc/refman/5.0/en/stored-procedures.html
-
Have you tried the php forum?
-
Ahhh... so you want to insert a record in table B that represent the total time for each VID in table A. INSERT INTO tableB (vid, time) SELECT vid, sum(time) FROM tableA GROUP BY vid;
-
Rewrite the entire query using join syntax to join tables rather than the where clause - makes reading queries a great deal easier (for me anyway) and you may come across the error in the process.
-
Import the file in two seperate portions - split the file as close to the middle as possible without actually splitting any query.
-
SELECT speed.* FROM speed INNER JOIN ( SELECT competitor, min(speed.time) AS time FROM speed GROUP BY competitor ) AS fastest ON speed.competitor = fastest.competitor AND speed.time = fastest.time ORDER BY speed.time
-
Are such complicated table names really necessary?
-
Insert the order_desc table information first and store the last insert id like this: $order_id = mysql_insert_id(); Then insert each order item table information with order_id set to $order_id.
-
What has to be done has to be done some way, I would just do what you need done my way
-
See if you can wrap your head around this instead: DROP TABLE IF EXISTS site; CREATE TABLE site ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'unique identifier', label VARCHAR(100) NOT NULL DEFAULT 'Label not defined' COMMENT 'site label', address VARCHAR(255) NOT NULL DEFAULT 'Address not defined' COMMENT 'site address', PRIMARY KEY (id) ) TYPE=MyISAM; DROP TABLE IF EXISTS room; CREATE TABLE room ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'unique identifier', label VARCHAR(100) NOT NULL DEFAULT 'Label not defined' COMMENT 'room label', layer_limit INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'layer limit', column_limit INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'layer limit', row_limit INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'layer limit', PRIMARY KEY (id) ) TYPE=MyISAM; DROP TABLE IF EXISTS server; CREATE TABLE server ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'unique identifier', site_id INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'site.id foreign key reference', room_id INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'room.id foreign key reference', layer_num INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'layer position', column_num INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'column position', row_num INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'row position', PRIMARY KEY (id), INDEX (site_id) ) TYPE=MyISAM; INSERT IGNORE INTO site (label, address) VALUES ('Primary', '101 Brick Road'); INSERT IGNORE INTO room (label, layer_limit, column_limit, row_limit) VALUE ('White Room', 3, 3, 3); INSERT IGNORE INTO server (site_id, room_id, layer_num, column_num, row_num) VALUE ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 1, 1), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 1, 2), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 1, 3), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 2, 1), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 2, 2), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 2, 3), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 3, 1), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 3, 2), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 1, 3, 3), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 2, 1, 1), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 2, 1, 2), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 2, 1, 3), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 2, 2, 1), ((SELECT id FROM site WHERE label = 'Primary'), (SELECT id FROM room WHERE label = 'White Room'), 2, 2, 3); SELECT server.* FROM server INNER JOIN site ON site_id = site.id AND site.label = 'Primary' INNER JOIN room ON room_id = room.id AND room.label = 'White Room' ; SELECT layer_num AS next_available_layer, count(*) FROM server INNER JOIN site ON site_id = site.id AND site.label = 'Primary' INNER JOIN room ON room_id = room.id AND room.label = 'White Room' GROUP BY layer_num HAVING count(*) < ( SELECT column_limit * row_limit FROM room WHERE label = 'White Room' ); That last query returns the next available layer and nothing is returned that the room is full.... try and extrapolate that query to provide the next available column and row... well... this is what I would do if confronted with the same task.
-
hmm.. I am a little confused, according to the above picture I could identify any box (server) with only three bits of information, the layer, the column and the position... whats the point of the other information (rack and level)? note: a rack can be identified by a column and a position
-
There is a remarkably high number of confusing questions being posted lately.
-
Use table joins just like a normal select statement.
-
Is layer and level the same value and row and position the same value too?
-
Looks like you are missing a bracket at ), NAME => )), NAME but the query is hard to read without some decent formatting!
-
for every record the parent_id must match an id in another record. for every record the parent_id must not match the id. for every record the root_id must match an id in another record. Are those the type of hints you are looking for?
-
the to in WHERE to='$username' might be a mySQL keyword... try adding backticks or rename the field.