Hi folks.Thank u a lot for your answers beforehand. I need to make a such thing
I have a table friendship (id,user_id,friend_id,status,timestamp)
So lets say I am a user with user_id=43 and I am visiting a user with user_id=15
In the profile it should be a connection line of friendships
Let me describe ... lets say I have...
I need a query to select data between two dates with today's date as a reference.
The database has a datetime field for "start" and a datetime field for "end".
$todays_date = date("Y-m-d H:i:s");
$q = "SELECT * FROM news WHERE `end` >= '" . $todays_date . "' AND `start` >= '" . $todays_date . "' ORDER BY id DESC";
The problem is t...
I'm hesitant to run this query which deletes data (for obvious reasons).
I would like to delete the the matching rows from two tables, where the ID = the ID of a third table (which i want to remain unaffected)
This is the exact query I would like to run:
DELETE FROM ItemTracker_dbo.Transaction t,
ItemTracker_dbo.Purchase ...
Hello all, I've got a somewhat complicated question for you cakephp experts.
Basically, I have created a db table called "locations". Every month I will get this table sent to me in csv format from a client. Unfortunately, instead of updating this table, I will have to empty it and reimport all of the records. Unfortunately, I cannot al...
Is there a way this hand coded query could become dynamic?
SELECT master.id,
(select count(0) as score1 from scores where scores.id = master.id AND scores.category = '1'),
(select count(0) as score2 from scores where scores.id = master.id AND scores.category = '2'),
(select count(0) as score3 from scores where scores.id = master.id AND ...
Table
id int(11) No auto_increment Change Drop Primary Index Unique Fulltext
email varchar(45) latin1_swedish_ci No Change Drop Primary Index Unique Fulltext
billpayment tinyint(1) No Change Drop Primary Index Unique Fulltext
dispatch tin...
Hi,
I have a very specific query that is acting up and I could use any help at all with debugging it.
There are 4 tables involved in this query.
Transaction_Type
Transaction_ID (primary)
Transaction_amount
Transaction_Type
Transaction
Transaction_ID (primary)
Timestamp
Purchase
Transaction_ID
Item_ID
Item
Item_ID
Client_ID
Lets...
Hello, Every one.
first of all, let me explain the table structure.
It is as follows.
Main Table - CategoryGroup
Fields - CatGroupID, GroupName, GroupType
Sample Data
CatGroupID | GroupName | GroupType
1 | Utility | Expense
2 | Auto | Expense
3 | Misc. | Expense
4 ...
I have one table in MYSQL
It has data like
Id Name
1 test
1 test
1 test123
2 test222
3 test333
I want the data like
Id Name RowNum
1 test 1
1 test 2
1 test123 1
2 test222 1
3 test333 1
Means i want assign row number on group of Id and Name ?
what should the script for same?
...
I'm still learning about MySQL. I may be making a very basic error, and I'm prepared to be chastened here...
What this query is trying to do is select the top members from our website based on a count of the number of book and recipe reviews they have made.
I'm making a calculation of the total in the SQL query itself. The query is s...
I'm looking at a database that has 3 tables into which I have to insert data:
resource
id (AUTO_INCREMENT)
name
resource_item
id (AUTO_INCREMENT)
name
resource_id (FK ref resource.id)
resource_item_business_function
id (AUTO_INCREMENT)
business_function_name
resource_item_id
What I'm struggling with is the fact that ...
basically i have albums, which has 50 images init.. now if i show list of images, i know from which to which row is showing (showing: 20 to 30 of 50), means showing 10 rows from 20 - 30. well now the problem is, i want to select an image, but still show which postion was it selected, so i can move back and forth, but keep the postion too...
Hi Friends
i have a tow table name t1,t2 . Based on the value insert in t1 i want to insert in t2 .
i use the following trigger .
create trigger testt after insert on t1
BEGIN
for each row
if NEW.uid='Mill' then insert into t2 (uid2) values (NEW.uid)
end if
if NEW.uid='Farm' then insert into t2 (uid2) values (NEW.r)
end if
END
Plea...
I have a MySQL table for which I do very frequent SELECT x, y, z FROM table WHERE x LIKE '%text%' OR y LIKE '%text%' OR z LIKE '%text%' queries. Would any kind of index help speed things up?
There are a few million records in the table. If there is anything that would speed up the search, would it seriously impact disk usage by the data...
I am running a MySQL query to rank my site's users according to the number of book reviews and recipe reviews they have contributed. After initial issues with a multiple JOIN query, I've switched to a series of subqueries, which is much, much faster. However, although I can extract the numbers of reviews from each member, I can't figure ...
Hi everyone. I am working on a reviews website. Basically you can choose a location and business type and optionally filter your search results by various business attribures. There are five tables at play here:
Businesses
ID
Name
LocationID
Locations
LocationID
LocationName
State
Attributes
AttributeID
AttributeName
AttributeValu...
I want to delete data from a table after a time interval has been passed and fill it with NULL value. I basically want that data to get expired after a certain interval of time. Is there any way to do it using Php. database is in Mysql.
Thanks.
...
I am looking for help in writing a query of retrieving the values from 2 tables in MySQL.
The scenario is
Table A
ID Name Marks
===================
23 John 67
45 Mark 45
12 Ram 87
Table B has the following Structure
ID Name Evaluation Marks
==============================
45 Mark 34
78 Chris...
Hello. My problem is described further under the table structure.
This is my tables for my advertising banner system:
banner
id (unique key)
title
bannersrc
maxhits
maxklik
activefrom
activeuntil
dato
bannerhits (number of shows)
id (unique key)
ip
bannerid (index) (referring to banner.id)
dato
bannerklik (number of click...
Hi guys, let's say that I have:
$query = $this->select()
->where('name LIKE ?','%something%');
->where('section LIKE ?','%something%');
->where('cars LIKE ?','%something%');
............
............
You get the point!
But I want to add the where() clause to the qu...