artacus
-
Posts
737 -
Joined
-
Last visited
Never
Posts posted by artacus
-
-
Use a left join and an OR in your where clause.
-
If its a smaller file < 2M, you can use PHPMyAdmin. If its a larger one, you'll need to do something like this, making the necessary adjustments for OS and file locations.
/usr/bin/mysql -u myUser -p myDatabase < /tmp/dbdump.sql
-
That's the best you're going to do, because you don't have all of the data you need in 1 row.
-
...if you have another acct that can add/modify users and such. Otherwise you have no choice but to reinstall mysql.
-
You'll have to left join this table back on itself so you can eliminate the ones w/ future close dates
SELECT COUNT(*) FROM status AS s1 LEFT JOIN status AS s2 ON s1.ApplNo = s2.ApplNo AND s2.Status = 'CLOS' WHERE s1.Status='PEND' AND s1.StatusDate BETWEEN '20070203' AND '20070306' AND s2.ApplNo IS NULL
-
PHP may not have permissions to use exec(), your apache user may not have permissions to execute that file or to write the dump file.
-
Is there a way just to write Recordset once and then write the query
//You could either just write it as one big string $query = "SELECT ... FROM ... WHERE... GROUP BY... " //or if you want to split it up just use "." to join the strings $query = "SELECT... " . "FROM ..." . "WHERE ... " . "GROUP BY... ";
I prefer the 1st one because it contains new line chars so if something is broken, you can echo it out enclosed in pre tags and have a much more readable query.
-
By table you mean an html table?
If you want to get 3,6 then use GROUP_CONCAT()
Otherwise, just query it and only display the info you want
-
-
I've got an idea that will work, but I don't think its very elegant. Maybe someone will post a better solution, but until then...
SELECT items.* FROM items JOIN ( SELECT item_id, GROUP_CONCAT(t_id) AS tids FROM tag GROUP BY item_id ) AS sub ON items.id = sub.item_id WHERE FIND_IN_SET(12, sub.tids) AND FIND_IN_SET(42, sub.tids)
-
Well if you don't know what you're looking for...
And did fenway slap you yet for using date as a field name? *slap*
Now that that is out of the way...
If you want to get products viewed today use:
WHERE DATE(VIEWED_PRODUCTS.DATE) = CURDATE()
-
Well, you can do 10,000 inserts per second for the next 2.9 million years and you'll still have a few pk's left.
10,000 inserts per month for a total of 1.2 million records is something your system can easily handle. You'll want to have good indexes set up for searching and joining for this many records. I have no idea how big your table is, if you've got text or blob fields you could run out of disk space.
-
what an ugly way to write your query (in php)...
Its harder for you to write the query because its not normalized. If you are not too far into this project, you may want to work thru a couple tutorials or even a book on db design.
Otherwise, its not a great design, but it is workable.
What I would do is get the match and the rating change in a sub query (so it doesn't matter if its player1 or 2), er you don't have a match_id, you should have a pk on your match table
SELECT FROM ( SELECT m.id, m.meetID IF(m.player1ID = '$playerID', m.rating1Before, m.rating2Before) AS ratingBefore, IF(m.player1ID = '$playerID', m.rating1Change, m.rating2Change) AS ratingChange, IF(m.player1ID = '$playerID', m.player2ID, m.player1ID) AS opponentID FROM matches AS m WHERE m.player1ID = '$playerID' OR m.player2ID = '$playerID' ) AS sub JOIN teams and such...
-
Your post doesn't make much sense. But you will run out of keys after 9,223,372,036,854,775,807 rows. Good luck filling that up.
-
It's easier (and usually always better) to just use an array
$p[$i] = $playername;
echo $p[1];
-
So convert it to a date first STR_TO_DATE()
-
SELECT MAX(id) FROM myTable
Or if you want the whole row
SELECT *
FROM myTable
WHERE id = (SELECT MAX(id) FROM myTable)
-
Is the first one an actual date or is it a string?
-
Didn't I just yell at you a little while ago for joining tables w/o using JOIN?
Write your query the correct way and we'll go from there.
-
Then you'll need to use innoDB tables because myISAM does not support fk relationships. I'm not really sure what you mean by "reference."
You can join them in a query w/o having fk's defined. phpMyAdmin also stores relationship information in a separate database if you have that set up right. But like I said, I'm not really sure what you are asking.
-
and explode() to split the line into a usable array.
-
The only problem with that is that it is SO hard to say ALWAYS in business. If you think that in the future your boss may come to you and say, "we need to extend so and so's ads for one more day because..." then stick with your current approach.
-
Oh, no. You definitely are able to use subqueries.
Post the query exactly as you had it (use the code tags please)
then the full error message.
-
Then you are using an older version of mysql that doesn't allow subqueries.
[SOLVED] Multiple select advice
in MySQL Help
Posted
No union. I'm not sure if you've got a full text index or not. Use match() against() if you do.