I know the $downloadfile - and I want the $user_id. By trial and error I found that this does what I want. But it's 3 separate queries and 3 while loops. I have a feeling there is a better way. And yes, I only have a very little idea about what I'm doing :)
$result = pod_query("SELECT ID FROM wp_posts WHERE guid LIKE '%/$downloadfile'")...
I'm having trouble building a query. I can do what I want in 3 different queries.
SELECT id FROM table1 WHERE url LIKE '%/$downloadfile'
put that in $url_id
SELECT item_id FROM table2 WHERE rel_id = '$url_id'"
put that in $item_id
SELECT rel_id FROM table2 WHERE rel_id = '$item_id' AND field_id = '42'"
put that in $user_id
But from re...
Thanks for looking on this problem.
I have a page that is totally valid page, and there is a PHP loop that brings in a <li> for each entry of the table.
When i check this page locally it looks 100% OK, but when veiwing the page online the left side bar (which creates this markup is broken randomly mixing <div>'s and <li>'s and i have n...
Is there any free tool for profiler of MYSQL database?
I want to capture the SQL statement from application.
and want to tune it for performenencae.
Can any one suggest?
Thanks,
Paresh
...
Hi all, i have a mysql table like this
+-----+---------+-----------+-----------------+-------+
| id | item_id | item_type | field_name | data |
+-----+---------+-----------+-----------------+-------+
| 258 | 54 | page | field_interests | 1 |
| 257 | 54 | page | field_interests | 0 |
| 256 | 54 |...
I am trying to return a number based on the count of results from a table and to avoid having to count the results twice in the IF statement I am using a subquery. However I get a syntax error when trying to run the query, the subquery I have tested by itself runs fine.
Any ideas what is wrong with the query? The syntax looks correct to...
during a month, display the infor each date, order by date, but this infor is empty in some day. how can i still display each day as a row?
Product date
-----------------
20 2008-01-01
10 2008-01-02
20 2008-01-03
10 2008-01-05
09 2008-01-08
30 2008-01-09
result:
Product date
-----------------
20 2008-01-...
Can I run a select statement and get the row number if the items are sorted?
I have a table like this:
mysql> describe orders;
+-------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------------+------+-----+----...
I want data for the the last 1 year from the given date For example:
I have date 2013-06-01
and I want data as follows also data I want is from three table using Group By or something else
Month | Amount | Total_Data
June 2013 100 5
May 2013 80 4
- 100 5
- 100 5
July 2012 ...
I am using following query which works fine for me except one problem
SELECT f.period as month,
sum(p.revenue * ((100-q.rate)/100)) as revenue,
count(distinct q.label) as tot_stmt
FROM files f, reports p, rates q,albums a
WHERE f.period in ('2010-06-01','2010-05-01','2010-04-01','2010-03-01')
AND f.period_closed = ...
Hi
I want to write a mysql statement which will return a list of results from one table along with a comma separated list of field from another table. I think an example might better explain it
Table 1
========================
id First_Name Surname
----------------------
1 Joe Bloggs
2 Mike Smith
3 Jane Doe
Table 2...
Hi
I have the following tables
CREATE TABLE `files` (
`fileid` int(11) NOT NULL AUTO_INCREMENT,
`filename` varchar(255) NOT NULL,
`filesize` int(11) NOT NULL,
`folder` int(11) NOT NULL,
PRIMARY KEY (`fileid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `folders` (
`directoryid` int(11) NOT NULL AUTO_INCREMENT,
`d...
This is my php code (I already have a connection to the db):
$result = mysql_query("SHOW TABLE STATUS FROM mydb LIKE 'mytable';");
while ($array = mysql_fetch_array($result)) {
$updatetime = $array['Update_time'];
}
echo $updatetime;
I get:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL r...
Duplicate of
http://stackoverflow.com/questions/9185/what-is-the-best-mysql-client-application-for-windows#9205
http://stackoverflow.com/questions/40902/looking-for-mysql-ide
Hello,
I've been wondering what you guys are using to write,debug,test your SQL queries there days?
The requirements are quite simple:
Auto-complete
Synta...
How do you deal with a join statement if one of the tables you are joining does not have any data for the user in it.
For example:
-user_1 is listed in all tables.
-user_2 is listed in table_1, table_2, and table_3 but not in table_4.
The following query fails because user_2 is not in table_4.
$query = "SELECT table_1.username, tabl...
Hello all,
I am creating a social bookmarking app. I am having a re-thought of the DB design in the middle of development.
Should I normalise the bookmarks table and remove the tag columns that I have into a separate table. I have 10 tags per bookmark and therefore 10 columns per record (per bookmark).
It seems to me that breaking the...
I will make an application with a lot of similar items (millions), and I would like to store them in a MySQL database, because I would like to do a lot of statistics and search on specific values for specific columns.
But at the same time, I will store relations between all the items, that are related in many connected binary-tree-like ...
With regards to the following statement:
Select *
From explorer.booking_record booking_record_
Inner Join explorer.client client_
On booking_record_.labelno = client_.labelno
Inner Join explorer.tour_hotel tour_hotel_
On tour_hotel_.tourcode = booking_record_.tourrefcode
Inner Join explorer.hotelrecord hotelrecord_
O...
Hi all,
I'm having a few issues executing sql statements in c++ using the connector.
Any hints or ideas are welcome.
NB: Mysql Connector c++ 1.05
I have these defined in the class header:
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *prep_stmt;
And the...
So I don't consider myself a novice at MySQL but this one has me stumped:
I have a message board and I want to pull a list of all the most recent posts grouped by the Thread ID.
Here's the table:
MB_Posts
-ID
-Thread_ID
-Created_On (timestamp)
-Creator_User (user_id)
-Subject
-Contents
-Edited (timestamp)
-Reported
I've tried many d...