Hi,
I have the following SQL generated from my Rails app, it is trying to get a list of all auto models that have live adverts in a marketplace app & from mysql:
SELECT `models`.* FROM `models`
INNER JOIN `autos` ON autos.model_id = models.id
INNER JOIN `ads` ON `ads`.id = `autos`.ad_id
WHERE (ads.ad_status_id = 4 AND pub_start_...
I'm trying to make a simple partial address search utility in PHP. The table in question simply has an "address" column. My goal is to be able to have the user enter a partial address into a form and have my script retrieve the 25 closest matches in that table.
The obvious and, in my opinion, sloppy way to do this would be to select eve...
I'd like to use string substitution for a comma-separated list, such as:
query = """SELECT id, name, image_id
FROM users
WHERE id IN (%s)
"""
values = (','.join(uids))
results = dbc.getAll(query, values
This executes the query:
SELECT id, name, image_id
FROM users
WHERE id IN ('1,2,3')
Which does no...
I'm following the documentation almost word for word, except for two adjustments which I believe are corrections.
First adjustment: I eliminate the redundant DIRECTORY_SEPARATOR in system/application/doctrine.php:
//this produces "...system/application//fixtures"
$config = array('data_fixtures_path' => dirname(__FILE__) . DIRECTORY_S...
Can anyone tell me if a SELECT command to mysql is case insensitive by default? and if not, what command would i have to send so that i can do something like:
SELECT * FROM `table` WHERE `Value` = "DickSavagewood"
where in actuality, the real value of `Value` is dicksavagewood
...
I have a table that stores messages from one user to another. messages(user_id,friend_id,message,created_date). My primary key is (friend_id,created_date). This prevents duplicate messages (AFAIK) because they will fail to insert.
Right now this is ok because my code generates about 20 of these queries at a time per user and I only hav...
I search a script with follow features:
The user can pay the full functional website for some time (week, month, six months, a year - for example).
After payment, the script pass a parameter that the user has paid, and the user data insert into the database mySQL (name, start subscription date, the subscription end date).
Each time whe...
I have the following table structure
+ id + word +
+------+--------+
The table gets filled with the words in lower cas of a given text, so the text
Hello bye hello
would result in
+ id + word +
+------+--------+
+ 1 + hello +
+------+--------+
+ 2 + bye +
+------+--------+
+ 3 + hello +
+------+--------+
I w...
Hello,
I'm working on a custom made forum and was wondering if I could get some others ideas and opinions on the matter.
I was wondering what would be the most efficient MySQL query to achieve the following.
Find all Categories. These will list their parent forum_id as "0".
Find all Forums. These will list their parent forum_id as th...
Hi, I've recently set up a new site that runs a database via MAMP. It's actually an expression engine site and I'm developing it at localhost:8888.
I was wondering if there's an easy way to share the site with someone else over the web (like a client) via my IP address while my local server is running.
Not sure if there are security is...
Hello guys,
Alright here is the problem... we have posts that are missing a custom field. We just recently received the values for that field.
Is there a way via phpmyadmin to insert in to the table post_meta a custom field named "translation" and then the value for each post already published?
I am trying to avoid having to go back t...
I seem to have a memory leak, one of the culprits seems to be the ConnectionProperty, whether it is String, Int or Boolean ones. e.g.:'com.mysql.jdbc.ConnectionPropertiesImpl$BooleanConnectionProperty', millions seem to be staying around and not being GC'd.
Here are my settings for the DB, Session Factory, Hibernate and Pooling etc..:
...
sorry if this is addressed, but i'm running
apache2
SQLAlchemy 0.5.8
Pylons 1.0
Python 2.5.2
and on a simple page (just retrieve data from DB), I get:
Error - : (OperationalError) (2006,
'MySQL server has gone away')
every few other requests, not after a long time as other posts I've searched
for. I still added
sqlalchemy....
I have used this query on many occasions and never had an issue. I just like to know is this the best option when updating 10,000 plus rows with 1 query?
I am updating and making changes to a postal codes database and some of these can get quite large.
This is what I am using (imagine it being 10,000 plus postal codes)
UPDATE postalco...
I am using a query like this:
SELECT * FROM table1 WHERE countries LIKE '%US%' OR countries LIKE '%ALL%';
This returns all the entries that have "US" or "ALL" in countries column, but I want it to return ONLY those rows that contains "US", and if non is found then use the next condition and return all that contains "ALL".
Is it possi...
I have a table of "Products". I also have a table of user labelled keywords for that product. I want to bring back the top keyword for each product based on how many there are.
The keyword table basically consists of the keyword, a primary key, and a foreign key linking it to the Products table.
I presume I have to join the keyword t...
I get the following Error below from my query, and was wondering how can I fix this problem?
Duplicate column name 'user_id'
Here is My MySQL query.
"SELECT COUNT(users_friends.user_id) FROM ((SELECT *
FROM users_friends
INNER JOIN users ON users_friends.user_id = users.user_id
WHERE users_friends.user_id = '" . $user_id . "'
AND us...
Hello chaps,
Having a spot of bother trying to grab some data out of my database.
I have the following model:
function GetRestaurants($options = array())
{
// Qualification
if(isset($options['restaurantID']))
$this->db->where('restaurantID', $options['restaurantID']);
if(isset($options['restaura...
I've got a query like this:
select a, b, c, group_concat(d separator ', ')
from t
group by a;
This seems to work just fine. As I understand it (forgive me, I'm a MySQL rookie!), it's returning rows of:
each unique a value
for each a value, one b and c value
also for each a value, all the d values, concatenated into one string
Thi...
Furthering: http://stackoverflow.com/questions/3910250/database-design-for-dynamic-form-field-validation/
How would I model the database when a particular field can have 0 or more validations rules AND that each validation rule is "related" to another rule via AND or OR.
For example, say I have field1 that needs to be minimum of 5 char...