Hello all
I have this table
CREATE TABLE IF NOT EXISTS `posts` (
`id` int(10) unsigned NOT NULL auto_increment,
`thread_id` int(10) unsigned NOT NULL,
`forum_id` tinyint(5) unsigned NOT NULL,
`cat_id` tinyint(3) unsigned NOT NULL,
`message` mediumtext collate utf8_unicode_ci NOT NULL,
`userid` int(10) unsigned NOT NULL,
`...
how do i select all records matching following criteria:
take all records with meeting_id = x AND it's parent is available OR doesn't have parent but don't care if available itself ?
table people:
id, name, address, meeting_id, available, parent_id
...
select count(distinct id) from svn where name='ant' and type='Bug'
and
select count(distinct id) from svn where name='ant' and type='Feature'
Is it possible to combine them into a single query that might reduce the execution time compared to running them individually?
Thanks for answering.
...
I've looked for this but no luck so far. I have two tables in mysql, they are configured as parent-child. The parent table has a field of type auto_increment, and the child has a field that references the autoincrement column in the parent. When I do inserts into the parent table everything goes fine. But when I do insert on the child ta...
I want to return a .JSON from a PHP script, do I just echo the result? Do I have to set header content-types?
Any help would be great!
...
I have an ec2 instance, but when i run mysql, it gives me this error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Similarly, when i run
/etc/init.d/mysql start
Oct 31 11:29:16 domU-12-31-38-00-A8-62 /etc/init.d/mysql[5263]: error: 'Can't connect to local MySQL server throu...
Hello,
Now i am working on a social network website and i already built the friends table for this website but i need some suggesion before i moved forward.
I have a user table where user_id is the primary field.
So for frinds i made a friends table with fields like
friend1,friend2,is_active
what i do actually when user1 send a frie...
I'm trying to deploy a small rails3 app to a FreeBSD host using capistrano and bundler. I have added the line
require 'bundler/capistrano'
to my deploy.rb file, and bundler seems to work fine until it comes to the mysql2 gem. Here the install fails because the install script uses chmod and chgrp to try to install the gem with root:whe...
Hi,
I asked a question about creating temporary/ virtual ids for query results,
http://stackoverflow.com/questions/4063998/mysql-php-temporary-virtual-ids-for-query-results/4064066#4064066
I nearly got I wanted with this link,
http://craftycodeblog.com/2010/09/13/rownum-simulation-with-mysql/
I have managed to enumerate each row,
SEL...
I have an SQL table as such
name | engins| frank
---------------------------+-------+------
John Smith | 8422| 854
(1 rows)
And need to make a query such that only return the row john smith when engins is more than 2000
...
Say this is my sql:
SELECT title,
author,
ISBN
FROM bs_books
ORDER BY ISBN
LIMIT 3
It just selects everything from a certain table (title, author, etc..).
Say I would like to select all the items that come after a certain title, not alphabetically or something but just the records after the certain elem...
Hi,
I think my question might be unclear , but i would try to explain it by example .
say that we had about 100 different car model , clearly all of the car would share common parts or specification but not all parts are shared between all of these 100 car brands
what is the best practice of storing these specification in this case...
This may be a tough one for you all, if it is even possible in mysql.
I have a table that stores id, catid, product_name
What i would like to do is select 3 records for each catid then display the result with each 3 sets of records first.
So if i have a catid of 4, 7 then I would like to display 3 results for (4) then 3 results for (7). ...
Possible Duplicate:
selecting items that come after a specific value
i asked this allready bu explained it very bad so i'm gonna do it right this time.
I have a mysql table like this:
ISBN title author price amount
978-0060850524 A Brave New World Aldous Huxley 6.49 7 ...
i seem to be having an error on this coding any help would be appreciated
Parse error: parse error in C:\wamp\www\espn.com\login.php on line 19
<?php
//Database Information
$dbhost = "localhost";
$dbname = "users";
$dbuser = "root";
$dbpass = "*****";
//Connect to database
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could no...
Hi. I have a strange problem. I tried this command in mysql:
SELECT `type`,
`bought`
FROM cars
WHERE owner = 'test'
ORDER BY type
And it prints out this in phpmyadmin:
type bought
--------------------
17 1281025497
22 1287708417
22 1287347244
24 1287708324
24 1287876461
6 12878...
Let's say I have a table that's like the following:
name VARCHAR(50) PRIMARY KEY NOT NULL
ordernum TINYINT UNSIGNED NOT NULL
Also let's say I have 3 rows.
something - 1
somethingelse - 2
somethingmore - 3
If i want to insert another entry called something1, and give it an ordernum of 2, how do I reorder all the rows that has an...
Hi. I use this code to update the user database with the latest time when the user was online:
$postTime = $user_array['last_online'];
if ($postTime == ""){
$minutes = 11;
} else {
$now = time();
$seconds = $now - $postTime; // $seconds now contains seconds since post time
$minutes = ceil($seconds / 60); // minutes sin...
It seems like most people use MySQL together with PHP. I've used H2 and Postgres with Java, but I can't really say why, I didn't evaluate any before I started.
Does some work best with a specific language?
Are there more stable ones that are better at large capacities?
...