I'm having a hard time finding the documentation for creating a unique dependency in a table where, for example, there are 2 columns and each one can have multiple similar values, but there must never be 2 rows where both columns have the same value (as in another row)...
in other words...
colA colB
row1 1 2 //this...
Hey, what's the most effective way to remove beginning and ending slashes from all rows in a particular column using MySQL?
Before:
/hello/world/
foo/bar/
/something/else
/one/more/*
After:
hello/world
foo/bar
something/else
one/more/*
...or maybe this should be done in PHP instead?
...
I've been stumped with some SQL where I've got several rows of data, and I want to subtract a row from the previous row and have it repeat all the way down.
So here is the table:
CREATE TABLE foo (
id,
length
)
INSERT INTO foo (id,length) VALUES(1,1090)
INSERT INTO foo (id,length) VALUES(2,888)
INSERT INTO foo (id,length) VALUES(3...
I'm having approx. 200K rows in a table tb_post, and every 5 minutes it has approx. 10 new inserts.
I'm using following query to fetch the rows -
SELECT tb_post.ID, tb_post.USER_ID, tb_post.TEXT, tb_post.RATING, tb_post.CREATED_AT,
tb_user.ID, tb_user.NAME
FROM tb_post, tb_user
WHERE tb_post.USER_ID=tb_user.ID
ORDER BY tb_po...
With full access to both db , order last ten post from two different wordpress blogs, ordering by post date.
In local way, not using foreign services (with sql and php for example)
...
When i refresh my flex application, the page does not hold its state and gets back to login page. I am not sure why this occurs, Here is my peiece of code handling session.
public function doLogin($username,$password) {
include("connection.php");
session_start();
session_register("session");
$query = "SELECT *
...
I have a site with an image uploader, and whenever a user tries to upload an image, they are getting this error message:
"No suitable nodes are available to serve your request."
I've contacted the hosting company(mosso) and they have said that it is nothing on their end. Any idea what causes this issue, and what I can do to fix it?
...
Hi,
After a quick Google I couldn’t find anything too promising so I was wondering if anyone knew if there is a good/widely used LINQ to MySql Data Provider out there?
...
I have a table that has an AUTO_INCREMENT field. Currently, it is also a PRIMARY KEY.
However, there are situations where I need this AUTO_INCREMENT column to permit duplicates. In other words - two different rows can have the same value inside the AUTO_INCREMENT column. This would mean having an AUTO_INCREMENT field that is not a PR...
Using PHP, I am trying to delete a record, but I want to check if it was successful or not. Is anything returned from a successful DELETE FROM foo where bar = 'stuff'?
Alternatively, do you know any other ways to check if a DELETE was successful? Or am I better off just making sure the row exists before I delete it? I am trying to avoi...
I have a list of e-mails from one database which I want to check against a list of unsubscribed e-mails from another database. If they exist in both lists, then I don't want them returned.
SELECT distinct `payer_email` as `email`
FROM `database1`.`paypal_table`
WHERE `payer_email` !=
(SELECT `email`
FROM `database2`.`Unsubscribers` ...
Hi,
I have a query that I know can be done using a subselect, but due to large table sizes (100k+ rows per table) I would like to find an alternative using a join. This is not a homework question, but it's easier to share an example in such terms.
Suppose there are two tables:
Students
:id :name
1 Tom
2 Sally
3 Ben
Books
:id ...
Alright i have a magic cards site and im trying to pull all of the cards from a certain set if you click on the set on the home page. www(dot)magiccards(dot)me the code on the first page is:
<?php
require("mysqlconnect.php");
$query = "SELECT COUNT(*) AS `Rows`, `set`,id FROM `magic_cards_copy` GROUP BY `set` ORDER BY `set`";
$r...
Hey, does anyone know the proper way to set up a MySQL database to gather pageviews? I want to gather these pageviews to display in a graph later. I have a couple ways mapped out below.
Option A:
Would it be better to count pageviews each time someone visits a site and create a new row for every pageview with a time stamp. So, 50,000 vi...
Background:
I have this "with rollup" query defined in MySQL:
SELECT
case TRIM(company)
when 'apple' THEN 'AAPL'
when 'microsoft' THEN 'MSFT'
else '__xx__'
END as company
,case TRIM(division)
when 'hardware' THEN Trim(division)
...
I have this bit of code:
//Restrict the SQL query with an AND clause if a member has been selected
if ($form_member_id != 0) {
$query .= "AND photos.member_id = '$form_member_id' ";
}
It is meant to refine a search query down to only the selected user, so the whole query together reads:
SELECT
photos.photo_id, members.member_name, p...
CREATE TABLE groups (
ug_main_grp_id smallint NOT NULL default '0',
ug_uid smallint default NULL,
ug_grp_id smallint default NULL,
KEY (ug_main_grp_id)
);
What does the KEY keyword mean? It's not a primary key, its not a foriegn key, so is it just an index? If so, whats so special about this type of index created with KEY? Sor...
Hi all, I have the following table:
id time text otheridentifier
-------------------------------------------
1 6 apple 4
2 7 orange 4
3 8 banana 3
4 9 pear 3
5 10 grape 2
What I want to do is select ...
To set the background: I'm interested in:
Capturing implicit signals of interest in books as users browse around a site. The site is written in django (python) using mysql, memcached, ngnix, and apache
Let's say, for instance, my site sells books. As a user browses around my site I'd like to keep track of which books they've viewed, ...
hi,
i am having problem with mysql , i am getting Table.'\phpmyadmin\pma_history' is marked as crashed and should be repaired .
which is creating problem for my site to access the database
can anybody help me to rid this error .
...