2012/09/04 11:43 -0700, Rick James
int(1) does not mean what you think. Probably you want TINYINT UNSIGNED.
Yeap, a real misfeature of MySQL. It is also one of the ways wherin MySQL puts
in C and takes PL1 away.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
2012/09/04 11:43 -0700, Rick James
You have DATETIME and TIMESTAMP. Keep in mind that TIMEZONE is timezone-aware;
DATETIME is not.
TIMEZONE is typo for TIMESTAMP?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql
int(1) does not mean what you think. Probably you want TINYINT UNSIGNED.
int(25), bigint(250) -- Eh?
INT is always 4 bytes (32-bits); BIGINT is always 8 bytes.
Use UNSIGNED wherever appropriate.
You have DATETIME and TIMESTAMP. Keep in mind that TIMEZONE is timezone-aware;
DATETIME is not.
I just noticed that MSAccess and SQL server support FIRST() and LAST()
functions. Is there an equivalent in MySQL? My research has come up
with nil so far.
Thanks,
Michael
Michael Caplan wrote:
Hi there,
I am trying to figure out how to flatten the result set of a join
query using
Thanks Nestor,
I thought about that, but limit 1 doesn't work in my scenario as I want
to access both the FIRST() and LAST() column for a result set
simultaneously. By telling MySQL to limit to 1, I could get the first,
but not the last. I want mysql to give me the first, drop everything in
Thanks Nestor!
I think I am almost there. However, how can I limit the result of a
JOIN in a query, and not the entire result set? For example:
SELECT
*
FROM
a
JOIN
b
ON
a.id = b.id
If I wanted all records from a and only the first record from b, how
would I integrate a LIMIT
PROTECTED]
Sent: Wednesday, March 08, 2006 11:10 PM
To: Dave Pullin
Cc: mysql@lists.mysql.com
Subject: Re: Aggregate functions in ORDER BY
Many thanks for that Dave.
Do you know whether it's possible for MySQL to return fully qualified
column names by default?
For example, I'd like
11:10 PM
To: Dave Pullin
Cc: mysql@lists.mysql.com
Subject: Re: Aggregate functions in ORDER BY
Many thanks for that Dave.
Do you know whether it's possible for MySQL to return fully qualified
column names by default?
For example, I'd like
select * from foo;
to return
Thanks for that Nicolas.
Yasir
Can you run without the Order By at all? If not, you may need to
properly join the tables.
I could reproduce the issue with MySQL 4.1 as well and I would go around
it myself by creating a temporaty table, populating it with the
aggregate, doing a select on the
All you are doing when you quote the expression like `COUNT(pets.pet_id)`
is referencing the column in the select by its default column name (which is
the same as the expression.)
That's why it only works when the expression is a column.
If you dont want the order by column to appear in the
Many thanks for that Dave.
Do you know whether it's possible for MySQL to return fully qualified
column names by default?
For example, I'd like
select * from foo;
to return
++--+
| foo.a | foo.b|
++--+
| 1 | Rex |
| 2 | Buddy|
|
Can you run without the Order By at all? If not, you may need to
properly join the tables.
I could reproduce the issue with MySQL 4.1 as well and I would go around
it myself by creating a temporaty table, populating it with the
aggregate, doing a select on the temp table and then of course
Jim Grill [EMAIL PROTECTED] wrote on 02/18/2005 03:17:39 PM:
Hi,
I need some SQL guru help on this one.
I'm trying to re factor an existing application where a number of clicks
grouped by keyword for two different time periods are needed. For
example, a user picks a date range and the
Jim Grill [EMAIL PROTECTED] wrote on 02/18/2005 03:17:39 PM:
Hi,
I need some SQL guru help on this one.
I'm trying to re factor an existing application where a number of clicks
grouped by keyword for two different time periods are needed. For
example, a user picks a date range and
Perhaps you should create a new table with an id column and a flag
column.
Select the found calls 5 or = 5 into that new table and set the flag.
Then do a left join of your t_callog_calls table on the new table
selecting only the rows where the flag is NULL, these should be the rows
not found by
Jay,
Tuesday, September 17, 2002, 10:45:51 PM, you wrote:
J On my server the MySQL database decided to die on me. So I killed it and
J restarted and that didn't work. So I just rebooted the machine. Now I'm
J getting this error below.
J Invalid SQL: SELECT COUNT(*) AS messages FROM
On Tue, Sep 17, 2002 at 11:59:42AM -0700, Richard Unger wrote:
My query:
SELECT
count(id),
count( IF(call_end - call_start 5, id, NULL) ),
count( IF(call_end - call_start = 5, id, NULL) )
FROM
t_calllog_calls;
My result:
1994
1956
35
However, 1956
Hi,
I think you should try to use 0 instead of NULL
Regards,
Gelu
_
G.NET SOFTWARE COMPANY
Permanent e-mail address : [EMAIL PROTECTED]
[EMAIL PROTECTED]
- Original Message -
From: Richard
I _thought_ it was the fault of the aggregate function, but now I'm really confused!
When I produce them as 3 separate queries, I still get numbers that don't add up:
mysql select count(id) from t_calllog_calls;
+---+
| count(id) |
+---+
| 1994 |
+---+
1 row in set
, September 17, 2002 12:08 PM
To: Richard Unger; [EMAIL PROTECTED]
Subject: Re: aggregate functions producing bad data
Hi,
I think you should try to use 0 instead of NULL
Regards,
Gelu
_
G.NET SOFTWARE COMPANY
Permanent e-mail address
id is the primary key. There are no entries in the DB where id=NULL
Cheers,
Rich
-Original Message-
From: Brian Reichert [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 17, 2002 12:16 PM
To: Richard Unger
Cc: [EMAIL PROTECTED]
Subject: Re: aggregate functions producing bad
In the last episode (Sep 17), Brian Reichert said:
On Tue, Sep 17, 2002 at 11:59:42AM -0700, Richard Unger wrote:
My query:
SELECT
count(id),
count( IF(call_end - call_start 5, id, NULL) ),
count( IF(call_end - call_start = 5, id, NULL) )
FROM
of calls.
Cheers,
Rich
-Original Message-
From: Gelu Gogancea [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 17, 2002 12:08 PM
To: Richard Unger; [EMAIL PROTECTED]
Subject: Re: aggregate functions producing bad data
Hi,
I think you should try to use 0 instead
-Original Message-
From: Dan Nelson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 17, 2002 12:31 PM
To: Brian Reichert
Cc: Richard Unger; [EMAIL PROTECTED]
Subject: Re: aggregate functions producing bad data
In the last episode (Sep 17), Brian Reichert said:
On Tue, Sep
: [EMAIL PROTECTED]
Subject: RE: aggregate functions producing bad data
what does
Select count(id) from t_calllog_calls where id IS NULL
give you?
On Tue, 17 Sep 2002, Richard Unger wrote:
That would just give me 1994 for all 3 columns of output.
What I want to know is how many calls
On my server the MySQL database decided to die on me. So I killed it and
restarted and that didn't work. So I just rebooted the machine. Now I'm
getting this error below.
Invalid SQL: SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=1
mysql error: Can't open file:
]
- Original Message -
From: Brian Reichert [EMAIL PROTECTED]
To: Richard Unger [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, September 17, 2002 10:16 PM
Subject: Re: aggregate functions producing bad data
On Tue, Sep 17, 2002 at 11:59:42AM -0700, Richard Unger wrote:
My query:
SELECT
PROTECTED]
[EMAIL PROTECTED]
- Original Message -
From: Brian Reichert [EMAIL PROTECTED]
To: Richard Unger [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, September 17, 2002 10:16 PM
Subject: Re: aggregate functions producing bad data
On Tue, Sep
, September 17, 2002 10:16 PM
Subject: Re: aggregate functions producing bad data
On Tue, Sep 17, 2002 at 11:59:42AM -0700, Richard Unger wrote:
My query:
SELECT
count(id),
count( IF(call_end - call_start 5, id, NULL) ),
count( IF(call_end - call_start = 5, id, NULL) )
FROM
Hi.
Could you run the following query:
SELECTIF(call_end - call_start 5, id, NULL) AS long,
IF(call_end - call_start = 5, id, NULL) AS short,
COUNT(*)
FROM t_calllog_calls
GROUP BY long, short
Given that I have not made any mistake, that should list all rows
Kris,
Friday, June 07, 2002, 1:21:48 PM, you wrote:
KS Sorry to bother the Guru's here, but I've recently started working on
KS getting a mySQL database up and running and I noticed that some
KS aggregate functions like MAX and MIN don't have 'DISTINCT' as an
KS optional arguement. Are these not
On 11-Jul-01 Nelson Goforth wrote:
I'm trying to return several pieces of information from a small table.
Table is 'tickets':
idCHAR(50)
group CHAR(50)
issuedDATE
used DATE
'issued' and 'used' are NULL until a date is entered. The found set
is
Don, thank you. The SELECT statement worked perfectly just as you
suggested. Though the books I have on MySQL are pretty good, trying
to figure more and more esoteric statements out is a bit of a
challenge, even just in terms of syntax.
Nelson
In looking via SELECT * FROM tickets, the
On Fri, 4 May 2001, Joel Desamero wrote:
Hello,
I was wondering if there is a way to aggregate string values when grouping together
results. I guess what I'm looking for is the string version of the SUM() function. Is
there such a thing in MySQL?
Thanks.
No. You could write your UDF
Jeremy D. Zawodny writes:
On Thu, Feb 22, 2001 at 12:39:41AM +0100, michi platzer wrote:
i need to write my own very basic aggregate functions for MySQL and
had a couple of questions regarding this:
* does anybody know of a site with a collection of UDF's written by other
35 matches
Mail list logo