sangprabv wrote:
I have these query:
SELECT SUM(price)*0.5 AS price1 FROM table WHERE partner = 'A';
SELECT SUM(price)*0.65 AS price2 FROM table WHERE partner = 'B';
Is it possible to make the queries into 1 single query? How to make it
happen? Many thanks for helps.
Willy
You can
Many thanks for the query. It works ;)
Willy
On Fri, 2009-09-04 at 08:09 +0200, Wolfgang Schaefer wrote:
sangprabv wrote:
I have these query:
SELECT SUM(price)*0.5 AS price1 FROM table WHERE partner = 'A';
SELECT SUM(price)*0.65 AS price2 FROM table WHERE partner = 'B';
Is it
Many thanks for your query, seems we need to group it like Wolfgang's
does.
Willy
On Thu, 2009-09-03 at 22:33 -0700, Manasi Save wrote:
may be you can use IN clause:
SELECT SUM(price)*0.5 AS price1, SUM(price)*0.65 AS price2 FROM table
WHERE partner IN ('A', 'B');
--
MySQL General
hi,all
can i get how long the client(s) in sleep staus after the client
connected to mysql server
how can i do it ?
thanks very much
tiredboy
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
is there a better way (hopefully simpler) to code this?
i want to get the user id of the logged in user to use in my next statement.
$q1 = sprintf(SELECT uid FROM users WHERE users.username='$username');
$result1 = mysql_query($q1);
$uid = mysql_fetch_array($result1);
$u = $uid['uid'];
it
You should escape $username before passing it to mysql if its user
submitted data ... sql-injection
one/two liner: but error prone!
$un = mysql_real_escape_string($username);
list($id) = mysql_fetch_row(mysql_query(SELECT uid FROM users WHERE
username='{$un}');
better would be
$result =
little error
-list($id) = mysql_fetch_row(mysql_query(SELECT uid FROM users WHERE
+list($uid) = mysql_fetch_row(mysql_query(SELECT uid FROM users WHERE
Majk
-Ursprüngliche Nachricht-
Von: majk.sko...@eventim.de [mailto:majk.sko...@eventim.de]
Gesendet: Freitag, 4. September 2009 13:00
AndrewJames wrote:
is there a better way (hopefully simpler) to code this?
i want to get the user id of the logged in user to use in my next
statement.
$q1 = sprintf(SELECT uid FROM users WHERE
users.username='$username');
The only improvement I can see is:
$q1 = sprintf(SELECT uid
-Ursprüngliche Nachricht-
Von: Per Jessen [mailto:p...@computer.org]
Gesendet: Freitag, 4. September 2009 13:05
An: mysql@lists.mysql.com
Betreff: Re: a better way, code technique?
AndrewJames wrote:
is there a better way (hopefully simpler) to code this?
i want to get the user id
hahah thank-you, love the responses here. you guys are awesome..
ps, where does the %s come from?
--
From: majk.sko...@eventim.de
Sent: Friday, September 04, 2009 9:11 PM
To: p...@computer.org; mysql@lists.mysql.com
Subject: AW: Re: a better way,
-Ursprüngliche Nachricht-
Von: AndrewJames [mailto:andrewhu...@gmail.com]
Gesendet: Freitag, 4. September 2009 13:35
An: Skoric, Majk; p...@computer.org; mysql@lists.mysql.com
Betreff: Re: AW: Re: a better way, code technique?
hahah thank-you, love the responses here. you guys are
mysqladmin processlist -v
or
mysql show processlist;
Cheers
Claudio
2009/9/4 stutiredboy stutired...@gmail.com
hi,all
can i get how long the client(s) in sleep staus after the client
connected to mysql server
how can i do it ?
thanks very much
tiredboy
--
MySQL General
You should store the current user id in a session variable. Then you
don't have to hit the database at all.
There really is no short way of doing it. Normally you would create a
function (i.e. runQuery) that you pass the query too. Then it handles
running the query, fetching the data, error
I run a process which loads a series of timestamped data into a table.
I use the TIMESTAMP column.
I have a single value with a timestamp of '2008-03-9 2:56:34.737'
which fails on insert with 'incorrect datetime'. Days before, and
after work. Hours later in the day work. I thought it might
What is your sql_mode set to?
I tried inserting that value into a timestamp column on our test server and it
works fine.
Regards
John Daisley
Mobile +44(0)7812 451238
Email j...@butterflysystems.co.uk
Certified MySQL 5 Database Administrator (CMDBA)
Certified MySQL 5 Developer
Cognos BI
Currently set to:
NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
On Fri, Sep 4, 2009 at 10:24 AM, John
Daisleyj...@butterflysystems.co.uk wrote:
What is your sql_mode set to?
I tried inserting that value into a timestamp column on our test server and
it
Is your table innodb? If so i think the 'STRICT_TRANS_TABLES' sql_mode 'may' be
causing the problem.
Try inserting the value as
'2008-03-09 02:56:34.737'
Do you get the same error?
What mysql version is your server?
Regards
John Daisley
Mobile +44(0)7812 451238
Email
Hi
Thanks for all the responses. However I am still stuck for a MySQL db I
can create
and code in PHP. Attached is a brief example of data to be used.
One problem I have is with providing a listing that includes ...
WTBC (Category without SubCats) and the 3 Zones (also, Cats without
Hi,
I noticed that the 6.11 branch is not available for download anymore. Did
they rename it to 5.4?
Thanks,
-Alex
I had already tried that, actually. Produces the same error. I
should have mentioned that as well, sorry!
The version is 5.1.34
thanks for the help, btw!
Martin
On Fri, Sep 4, 2009 at 11:14 AM, John
Daisleyj...@butterflysystems.co.uk wrote:
Is your table innodb? If so i think the
I upgraded to MAC OS 10.6 Snow Leopard over the weekend and now I find that
upgrade appears to have broken MySQL (5.1.31 MySQL Community Server (GPL)).
When I attempt to start MySQL I get:
ERROR 2002: (HY000): Can't connect to local MySQL server through socket
'/tmp/mysql.sock (2)
Has anyone
One of my potential clients want to migrate their application to web based
(PHP MySQL), estimates of the data size is 24GB and growth per month is
20MB of data. Unfortunately, they could only use 1 sever machine with 4GB
RAM.
The application used in intranet, just running simple transactions
What sort of data? Is it currently stored in a database? If so, how many
tables?
24GB of text data in a single table is quite a bit, but manageable if
maintained properly.
24 GB of binary data on the other hand, is not very much at all.
Colin
On Friday 04 September 2009 12:48:18 pm
given the following table layouts
URLs:
URL_ID (primary key for URL)
URL_TEXT
URL_CATEGORY
URL_ID (key which points to URL.URL_ID)
CATEGORY_ID (key which points to CATEGORY.CATEGORY_ID)
SUBCATEGORY_ID
PK: (URL_ID, CATEGORY_ID)
CATEGORY
CATEGORY_ID (primary Key for Category)
The size of the data is largely irrelevant, it depends on how much of
it you need to use at once. For most setups, 4GB should be more than
enough. A single server is always a bad idea since it's a single point
of failure.
Concurrent users isn't really relevant with the database either since
it's
I don't appear to have a /etc/my.cnf file - could the upgrade have removed
it?
Here is the error string I get when I try and start MySQL:
finhagens-macbook-pro:bin finhagen$ ./mysqld
[1] 4697
finhagens-macbook-pro:bin finhagen$
090904 10:25:18 [ERROR] Can't find messagefile
You could mash it into two lines. Though I think the verbose syntax is more
readable.
mysql_fetch_array( mysql_query(SELECT uid FROM users WHERE
users.username='.mysql_real_escape_string($username).') );
$u = $uid['uid'];
However do you really think that 4 lines is too much to make a
Mysql doesn't store sub-second values.
try
2008-03-09 02:56:34
Instead of
2008-03-09 02:56:34.737
Regards,
Gavin Towey
-Original Message-
From: Proemial [mailto:proem...@gmail.com]
Sent: Friday, September 04, 2009 8:37 AM
To: John Daisley
Cc: mysql@lists.mysql.com
Subject: Re: Fwd: Help
Given table: CREATE TABLE testtab (d_col CHAR(4));
Question 1: It appears that there is no harm in just appending
directives onto the alter table command even if the order doesn't make
sense. It appears the parser figures it out... For example...
ALTER TABLE testtab ADD COLUMN c_col char(4)
+2
-Original Message-
From: Brent Baisley [mailto:brentt...@gmail.com]
Sent: Friday, September 04, 2009 6:21 AM
To: AndrewJames
Cc: mysql@lists.mysql.com
Subject: Re: a better way, code technique?
You should store the current user id in a session variable. Then you
don't have
If your table testtab is populated, neither suggestion is efficient.
You could the following instead:
#
# Create an empty table `testtab_copy`
#
1) CREATE TABLE testtab_copy LIKE testtab;
2) Do either of you suggestions:
ALTER TABLE testtab ADD COLUMN c_col char(4) FIRST,ADD COLUMN b_col
At 11:48 AM 9/4/2009, you wrote:
One of my potential clients want to migrate their application to web based
(PHP MySQL), estimates of the data size is 24GB and growth per month is
20MB of data. Unfortunately, they could only use 1 sever machine with 4GB
RAM.
The application used in intranet,
On Sat, Sep 5, 2009 at 5:10 AM, mos mo...@fastmail.fm wrote:
At 11:48 AM 9/4/2009, you wrote:
One of my potential clients want to migrate their application to web based
(PHP MySQL), estimates of the data size is 24GB and growth per month is
20MB of data. Unfortunately, they could only use
On Friday 04 September 2009 08:15:35 pm muhammad subair wrote:
On Sat, Sep 5, 2009 at 5:10 AM, mos mo...@fastmail.fm wrote:
At 11:48 AM 9/4/2009, you wrote:
One of my potential clients want to migrate their application to web
based (PHP MySQL), estimates of the data size is 24GB and growth
34 matches
Mail list logo