This is a pretty simple question really, but let's say I'm creating a model for Person. Person obviously has first name, last name, age, etc. But the person also has contact info consisting of things like address line 1, address line 2, city, state, zip, country, phone 1, phone 2, etc...
Does it make more sense to create a model for P...
Hello,
I have to rewrite a query written for mysql5 to mysql4.0 which doesn't support sub select I have a query like this :
select a,
c,
(select count(*) from A) as e
from (select b, sum(e) as a
from B
where h = "foo"
group by b) TABLEB,
(select sum(d),...
I am hosting a site on a buddy's server. It is using MySQL, PhP and Druapl. He is complaining that it is using up all his bandwidth but for the life of me I can't figure out why. There is not image/video hosting and I believe he has ~60 GB/month. Almost all the bandwidth would be used by databases. I think the problem lies in one of the ...
First of all, I know this SHOULDN'T work. We're using a very old DAL/ORM (Pear/DB/GenericDao based) layer that incorrectly surmises that id is not an autoincrement/integer field.
This statement DOES work in 5.0 Linux, DOES NOT work in 5.1 Windows. Is there a setting that could be different in my ini (ignore_type_errors="yes":))? I ...
Query:
SELECT project_id,
COUNT(*) AS count,
MIN(date_added) AS date_start,
MAX(date_added) AS date_end
FROM my_table
GROUP BY project_id, TIMESTAMPDIFF(MINUTE, date_added) < 5
WHERE user_id = 1 LIMIT 10
How can I accomplish this? I want to group the items so that no two consecutive items in a group...
Let's say we have a table with user comments. First-level comments have a reference to an article they are attached to. Deeper-level comments do not have this reference by design but they have a reference to it's parent comment.
For this database structure - what would be the most efficient way to fetch all comments for a given article...
My web application has a report that shows the number of logins by a particular user each week. However, I'm struggling to get the query just right. The problem I'm running into is that I can't seem to get the weeks during which the user did not login at all.
Currently my query looks like this:
SELECT
DATE_ADD(logDate, INTERVAL(1-D...
Hi everybody, i'm doing a query where i want retrieve some records when i do the query without 'limit' the result returns me the correct number of rows, but when i use limit the result returns me the half of the rows. the query im using is something like this:
SELECT
WGI_TaxoName.ScientificName,
WGI_Locality.Locality,
IFNULL(C...
Hello!
I have an existing mysql db used by a rails app. I want to create a Ruby script to run to perform a weekly maintenance task on the database. My first line is:
require 'mysql'
I have tried various 'paths' to point there but get an error message like:
1:in `require': no such file to load
I have:
code at: \ruby\sites\som...
I have a web site using a database named lets say "site1". I am planning to put another site on the same server which will also use some of the tables from "site1".
So should I use three different databases like "site1" (for first site specific data), "site2" (for second site specific data), and "general" (for common tables). In which ...
Unable to determine what is the best way to connect to mysql database in struts..
We can always use DriverManger and Class.forName() to connect.
DataSource interface - but this has problems I am getting compliation error for
DataSource dataSource = (DataSource)context.getAttribute(Globals.DATA_SOURCE_KEY);
or when Action.Data_SOURCE_K...
hello i am trying to use Codeigniter to build a simple user image gallery where a user can upload an image and then this will be auto displayed on another page.
I have the image uploading done as explain on the user guide on Codeigniter and this works fine dumps the image in a folder in the root just placing the URL in one table area an...
Background Information:
I'm part of a team of developers that runs a web application that stores and retrieves HIPAA (medical) data. Recently, the HIPAA guidelines were updated to include a policy that requires that all identifying client information be encrypted when it is "at rest" (stored in the database and not being accessed).
The...
I have spent around 4-5 hours installing and configuring Ubuntu 10.04 (Desktop) on this old computer I have and it seems real sluggish. I thought I would seek some advice here before I invested more of my time. I would like a GUI (for VNC access) but it is not required, and better webpage generation performance. Any reccomendations?
...
Hello,
I am trying to turn something I requested from a MySQL table into a 'link', which is also saved in the table. Therefore, in the code below, I am trying to turn 'fldFullName' into the 'ProfileURL', both which are in the same table. After that, I should be able to click on the Full Name, say maybe John Smith, and it should take me ...
Hi im trying to use Sql within MySql to sort some values and this is what I have:
Select from my table the rows where the value in column status equals online and the value in column tags equals museum, order them by name and in ascending order.
SELECT *
FROM tech
WHERE `STATUS` = 'online'
AND `TAGS` = 'museum'
ORDER BY NAME ASC
...
I'm dealing with a database where items are "tagged" a certain number of times.
item (100k rows)
id
name
other stuff
tag (10k rows)
id
name
item2tag (1,000,000 rows)
item_id
tag_id
count
I'm looking for the fastest solution to:
Select items that have been tagged as X, Y, and Z (where X, Y, and Z correspond to (possibly) tag...
Hi,
I have 2 db mysql at two locations, i need to copy the schema from first to the second one without hurting the data that is already existing in the II location.
Is it possible to achieve this?
Please experts help.
...
Hi all,
I have a parent category that holds all Cars names, denoted by parent_name in table "parent". For each of these parents, there could be any number of car models & they all go in table called "model". Each of these models can have any number of images & refereced via the model_id as the Foreign Key. My task is to show all the Par...
This is basically an extension of Update multiple rows with one query?. I want to be able to update multiple columns of multiple rows at a time, but not necessarily to update every column of every row.
Here is an example command I would like to be able to execute:
UPDATE person
SET name = CASE id
WHEN 1 THEN 'Jim'
WHEN 3 THEN ...