I know I must be missing something simple here...but I'm having problems with writing an SQL sub query. Given the following data
user_id question_id answer_text
89 1 value1
89 2 value2
80 2 value2
99 2 value2
96 1 value1
96 2 ...
Hi,
I have in my database car incidents for example. These incidents have a latitude and longitude. On a mobile using the GPS, I get the user's location with his coordinates. The user can select a radius that he wants to know if there are incidents around him. So let's say he want to know incidents 2 miles around him.
So I send from th...
i got this sp:
DROP TABLE IF EXISTS SplitValuesDump;
CREATE TABLE SplitValuesDump (
value VARCHAR(1000) NOT NULL PRIMARY KEY
);
DELIMITER $$
DROP PROCEDURE IF EXISTS `ChangeSitesRedirects`$$
CREATE PROCEDURE `ChangeSitesRedirects`(
prodimainAddress varchar(255),
subdomainMainAddress varchar(255)
)
SQ...
Hello.
I have two tables, foo and bar:
+----+-----+ +----+-----+
| id | val | | id | val |
+----+-----+ +----+-----+
| 1 | qwe | | 1 | asd |
| 2 | rty | | 3 | fgh |
+----+-----+ +----+-----+
id is not unique here. Not all IDs in foo have their equivalents in bar and vice versa. I need to count all rows with spec...
Hi,
i have a table 'tag_article_assoc' with [tagId,articleId] fields. i want to
insert new tags for a specific article (lets say articleId=23) but skip records already in db.
i am not sure on the right syntax, any ideas?
INSERT INTO wd_article_tag_assoc (tagId,articleId) VALUES ('$upTag','23') ON DUPLICATE KEY UPDATE...
thanks
S
...
I have to update one column from my user table .
Current record in User Table
**id , user_name**
1 , sachin rathore
2 , dilip CHOUHAN
3 , GariMA JAIN
I want to update user_name column like this
1 , Sachin Rathore
2 , Dilip Chouhan
3 , Garima Jain
User column should be in titlize form means first letter of each word should ...
I have a simple MySQL query like:
SELECT *
FROM `content_category` CC , `content_item` CI
WHERE CI.content_id = '" . (int)$contentId . "'
AND CI.category_id = CC.category_id
AND CI.active = 1
Both tables have a column called configuration one of which gets overwritten in the query i.e only content_item.configuration is ret...
This question probably has no definite answer, so if it's considered subjective and, let's say bad, please feel free to close it.
Basically I am developing a pretty big web application (PHP), and it uses CakePHP. Right now it's under development and some things in the Database are really complex therefore lots of queries need to be made...
Hi,
I want to search the matching strings from a mysql table. The search string is not a correct sentence, its only a part of the sentence.Any one can help me.?
Thanks in advance...
Nimmy
...
I have a weird problem. Every time i execute this query in php i get the output "Challenge" even if the query is empty (should get "emptyq" if empty) when i test it in phpmyadmin everything is great and query is empty when it should be. I also tried to echo $detectChallengeRes[0][1] and got nothing. I cant find the problem, any help is v...
I'm have 5 tables.
First products like:
id | country_ids | category_ids | users_ids
1 | 1,4,6 | 4,5,6,70 | 5,6,9
2 | 5,6,3 | 4,8,2,11 | 1,5,8
Second countries like:
c_id | c_name
1 | Åland Islands
2 | Antarctica
...
Third categories like:
cat_id | cat_name
2 | Small
4 | Large
....
I have two tables, one that contains nodes and second that contains the relationships between them like so:
Table A (named Node)
NodeID | NodeName
100 | Name 1
101 | Name 2
102 | Name 3
Table B (named Relationship)
NodeParent | NodeChild
100 | 101
101 | 102
I need to execute a query that needs to f...
I see some people do joins like this
SELECT * FROM table1
JOIN table 2
ON table1_id = table2_id
where as some people do this
SELECT *
FROM table1
WHERE table1.table1_id = tabl2.table2_id;
whats the difference and what is more efficient and benificial
...
I have a situation where I've got file names stored in two fields in a table. The fields are called file1 an file2.
file1 is ALWAYS present. file2 might not be present for some rows.
I want to write a query that would get me only a certain extension of files from the DB.
For that I am using for example
...WHERE file1 LIKE '%jpg%'
...
Hi again,
using mysql and php,
I have two tables, I'm french so the table names may sound weird,
but I would like to keep them as originals to avoid errors when testing…
"arborescence" (it means categories)
"arborescence_domaine" (it means the subdomains for the categories)
The aim of this system is to be able to have great control
on...
Alright Im trying to retrive the number of rows where members are individual and active.
Ive narrowed the problem to my model. Everything was working fine until I added a second clause to my get_where
Here is my model function
function count_individual_active_members()
{
$query = $this->db->get_where('Membership', arr...
Hello ALL,
I have following table structure
table_country ==> country_id (PK) | country | status
table_department ==> department_id (PK) | department | country_id (FK)
table_province ==> province_id (PK) | province | department_id (FK)
table_district ==> district_id (PK) | district | province_id (FK)
NOTE: all tables engine are inn...
Hi All,
I want a search functionality in my application for the data like following
topic_id tag
1 cricket
1 football
2 football
2 basketball
3 cricket
3 basketball
4 chess
4 basketball
Now when i search for term cricket AND football o/p should be
topic_id
...
Tables are: user_table(user_id, user_name) , votes_table(id,user_id, vote_date, votes)
$sql = SELECT user_id, sum(votes) AS sumvotes, vote_date
FROM votes_table
WHERE vote_date > 1279749600
ORDER BY sumvotes DESC
LIMIT 10
$result = query($sql)
foreach user_id in $result
$sql = SELECT user_id, username
FROM ...
I want to write a program which will backup an entire drive in a MySQL server using java, but I am confused.
How do I create the table (what data types?), how do i insert the row like what should be the primary key, and what should be the max size of each file be?
If you have any suggestion please help me out. Thank you for sparing yo...