Re: find any row with NULL

2016-07-29 Thread Hal.sz S.ndor
... Now - would searching, saving/storing then removing NULL vs ALLbutNULL in a simple DB with one table wich has only primary key be sa ... What is "removing NULL"? Deleting the record with NULL? It has no bearing on the primary key, because NULL never is allowed in one. It s

Re: find any row with NULL

2016-07-29 Thread Johan De Meersman
- Original Message - > From: "lejeczek" <pelj...@yahoo.co.uk> > Subject: Re: find any row with NULL > ok, whereas that fist example was about all (and find > columns' names without knowing) columns - would there be a > simple(r) syntax to find that (not)NU

Re: find any row with NULL

2016-07-29 Thread Johan De Meersman
- Original Message - > From: "lejeczek" <pelj...@yahoo.co.uk> > Subject: Re: find any row with NULL > > shame NULL won't work as in: > > select user_id,completetion_time from depression where > NULL in(email_me, other_diagnosis); > or does i

Re: find any row with NULL

2016-07-29 Thread lejeczek
On 09/07/16 14:13, Hal.sz S.ndor wrote: 2016/07/08 09:15 ... Johan De Meersman: You will have to repeat all the column names - no wildcards in where clause fieldnames - but the clause you're looking for is WHERE field IS NULL. Or IS NOT NULL if you want those:-) Well, one could try

Re: find any row with NULL

2016-07-13 Thread Johan De Meersman
- Original Message - > From: "Sándor Halász" <h...@tbbs.net> > Subject: Re: find any row with NULL > > from information_schema.columns where (table_schema, table_name, You could, but information_schema queries can get pretty slow on large databases, espec

Re: find any row with NULL

2016-07-09 Thread Hal.sz S.ndor
2016/07/08 09:15 ... Johan De Meersman: You will have to repeat all the column names - no wildcards in where clause fieldnames - but the clause you're looking for is WHERE field IS NULL. Or IS NOT NULL if you want those:-) Well, one could try this: set @sel=(select 'SELECT ' || GROUP_CONCAT

Re: find any row with NULL

2016-07-09 Thread william drescher
is not in stock' (count = 0) and 'I have not counted this product yet' (count IS NULL). Excellent example -bill -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql

Re: find any row with NULL

2016-07-08 Thread Johan De Meersman
You will have to repeat all the column names - no wildcards in where clause fieldnames - but the clause you're looking for is WHERE field IS NULL. Or IS NOT NULL if you want those :-) Remember, NULL is a special value that is not the same as zero or the empty string; nor to itself: NULL

find any row with NULL

2016-07-08 Thread lejeczek
hi there, I've been searching the vastness of the net but cannot find - how - to get all the rows with a NULL. And like any novice I wonder if this can be done without reiterating all the columns names(not manually at least)? Some expert would say it is easy, how easy

Re: mysql query for current date accounting returns NULL

2016-03-26 Thread shawn l.green
) it returns NULL. So how can i can get the value even if user acttstoptime is null? Try this...(using an earlier suggestion to the thread) SELECT SUM(acctinputoctets + acctoutputoctets) AS Total FROM radacct WHERE radacct.username='%{User-Name}' AND acctstarttime BETWEEN CURDATE

Re: mysql query for current date accounting returns NULL

2016-03-26 Thread shawn l.green
-%d') AND NOW() AND acctstoptime between DATE_FORMAT(NOW() ,'%Y-%m-%d') AND NOW()) AND radacct.username='%{User-Name}' It works fine if there is acctstoptime value in table. but if user have not disconnected yet (and have no previous session for today) it returns NULL. So how can i can get

Re: mysql query for current date accounting returns NULL

2016-03-25 Thread Hal.sz S.ndor
() ,'%Y-%m-%d') AND NOW()) AND username='%{User-Name}' It works fine if there is acctstoptime value in table. but if user have not disconnected yet (and have no previous session for today) it returns NULL. That expression has problems. Not only it works only when both acctstarttime

mysql query for current date accounting returns NULL

2016-03-25 Thread JAHANZAIB SYED
DATE_FORMAT(NOW() ,'%Y-%m-%d') AND NOW()) AND radacct.username='%{User-Name}' It works fine if there is acctstoptime value in table. but if user have not disconnected yet (and have no previous session for today) it returns NULL. So how can i can get the value even if user acttstoptime is null?

Re: Update Column in table only if variable is Not NULL

2013-10-30 Thread Neil Tompkins
Shawn What I need is that if I pass say 10 parameters/variables to a query, I only want to update the column/field if the value passed is NOT NULL. On Wed, Oct 30, 2013 at 3:41 AM, Shawn Green shawn.l.gr...@oracle.comwrote: Hi, On 10/29/2013 9:52 PM, h...@tbbs.net wrote: 2013/10/29 11:35

Re: Update Column in table only if variable is Not NULL

2013-10-30 Thread Shawn Green
Hi Neil, On 10/30/2013 9:55 AM, Neil Tompkins wrote: Shawn What I need is that if I pass say 10 parameters/variables to a query, I only want to update the column/field if the value passed is NOT NULL. On Wed, Oct 30, 2013 at 3:41 AM, Shawn Green shawn.l.gr...@oracle.comwrote: Hi, On 10

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread Michael Dykman
of the UPDATE statement I provided shows updating only 1 field. However in my live working example, I have about 20 possible fields that might need to be updated if the variable passed for each field is NOT NULL. Therefore, I felt this needs to be done at database level in the stored procedure. How

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread Shawn Green
that might need to be updated if the variable passed for each field is NOT NULL. Therefore, I felt this needs to be done at database level in the stored procedure. How can I accomplish this. Thanks Neil On Mon, Oct 28, 2013 at 6:17 PM, Shawn Green shawn.l.gr...@oracle.com mailto:shawn.l.gr

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread hsv
2013/10/28 21:23 +, Neil Tompkins Basically the snippet of the UPDATE statement I provided shows updating only 1 field. However in my live working example, I have about 20 possible fields that might need to be updated if the variable passed for each field is NOT NULL. Well, maybe

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread hsv
2013/10/29 11:35 -0400, Shawn Green My favorite technique is the COALESCE function for this on a column-by-column basis SET FieldName1 = Now(), FieldName2 = COALESCE(:MyVariable, FieldName2) but if MyVariable is NULL, FieldName1 reflects the attempt to change, not change. -- MySQL

Re: Update Column in table only if variable is Not NULL

2013-10-29 Thread Shawn Green
Hi, On 10/29/2013 9:52 PM, h...@tbbs.net wrote: 2013/10/29 11:35 -0400, Shawn Green My favorite technique is the COALESCE function for this on a column-by-column basis SET FieldName1 = Now(), FieldName2 = COALESCE(:MyVariable, FieldName2) but if MyVariable is NULL, FieldName1 reflects

Update Column in table only if variable is Not NULL

2013-10-28 Thread Neil Tompkins
Hi If I have a update statement like UPDATE MY_TABLE SET FieldName1 = Now(), FieldName2 = :MyVariable WHERE FieldName3 = 'Y' How can I only update the FieldName2 field if the value of MyVariable is NOT NULL ? Thanks Neil

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Andy Wallace
Try: update my_table set fieldname1 = Now(), Fieldname2 = :myVariable where Fieldname3 is not null On 10/28/13 11:06 AM, Neil Tompkins wrote: Hi If I have a update statement like UPDATE MY_TABLE SET FieldName1 = Now(), FieldName2 = :MyVariable WHERE FieldName3 = 'Y' How can I only update

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Shawn Green
Hello Neil, On 10/28/2013 2:06 PM, Neil Tompkins wrote: Hi If I have a update statement like UPDATE MY_TABLE SET FieldName1 = Now(), FieldName2 = :MyVariable WHERE FieldName3 = 'Y' How can I only update the FieldName2 field if the value of MyVariable is NOT NULL ? Thanks Neil This needs

Re: Update Column in table only if variable is Not NULL

2013-10-28 Thread Neil Tompkins
is NOT NULL. Therefore, I felt this needs to be done at database level in the stored procedure. How can I accomplish this. Thanks Neil On Mon, Oct 28, 2013 at 6:17 PM, Shawn Green shawn.l.gr...@oracle.comwrote: Hello Neil, On 10/28/2013 2:06 PM, Neil Tompkins wrote: Hi If I have

Re: Automatic reply: access denied to non-root@localhost null-string user in USER_PRIVILEGES

2013-01-03 Thread Shawn Green
version there is this extra line in the information_schema.USER_PRIVILEGES table: | ''@'localhost' | NULL | USAGE | NO | (Note the null-string user prepended to @localhost) Again: the functional, non-broken state does NOT have

Re: Automatic reply: access denied to non-root@localhost null-string user in USER_PRIVILEGES

2012-12-27 Thread Round Square
in the information_schema.USER_PRIVILEGES table: | ''@'localhost' | NULL | USAGE | NO | (Note the null-string user prepended to @localhost) Again: the functional, non-broken state does NOT have this entry. Thus, my current theory is that this line

access denied to non-root@localhost null-string user in USER_PRIVILEGES

2012-12-26 Thread Round Square
' | NULL | USAGE | NO | (Note the null-string user prepended to @localhost) Again: the functional, non-broken state does NOT have this entry. Thus, my current theory is that this line is the culprit. Prior to the failure I had a surge of experimental

Re: access denied to non-root@localhost null-string user in USER_PRIVILEGES

2012-12-26 Thread Igor Shevtsov
in the information_schema.USER_PRIVILEGES table: | ''@'localhost' | NULL | USAGE | NO | (Note the null-string user prepended to @localhost) Again: the functional, non-broken state does NOT have this entry. Thus, my current theory is that this line is the culprit

CONCAT_WS and NULL

2012-12-11 Thread hsv
This is, maybe, a question of taste. I find it useful in the aggregate functions that they ignore all NULLs that come under their purview, but yield NULL if nothing else comes. Now, CONCAT_WS is no aggregate function, but is like them in that it ignores all NULLs that come its way, aside from

query problem with null

2012-03-09 Thread Richard Reina
When I do the following query: SELECT * FROM geo_trivia WHERE city IS NULL; certain columns that DO have 'NULL' value for city and not a '' (blank) value do not show up. I have even gone to the extent of reseting these records value as ='NULL' with UPDATE and they are still are not selected

RE: query problem with null

2012-03-09 Thread David Lerer
Have you tried to set city = null (i.e. without the quotes)? David. -Original Message- From: Richard Reina [mailto:gatorre...@gmail.com] Sent: Friday, March 09, 2012 4:24 PM To: mysql@lists.mysql.com Subject: query problem with null When I do the following query: SELECT * FROM

Re: query problem with null

2012-03-09 Thread Richard Reina
Ahhh... Thank you, that was exactly what the problem was. I will fix the code that is setting the value of these new records to 'NULL'. Thank you. 2012/3/9 David Lerer dle...@us.univision.com Have you tried to set city = null (i.e. without the quotes)? David. -Original Message

Re: query problem with null

2012-03-09 Thread Johan De Meersman
- Original Message - From: David Lerer dle...@us.univision.com Have you tried to set city = null (i.e. without the quotes)? Spot on, I'd think. NULL values are not a string with NULL in it - that's only what it looks like in query results :-) An empty string ('') is to strings

Unique on non null entries but allowing multiple nulls

2011-10-17 Thread Peng Yu
Hi, If I use NULL UNIQUE when I create a table, it seems that only one NULL entry is allowed. Since NULL could mean unknown, in this case, two unknowns are not the same and I want to allow multiple nulls but I still want non null entries be unique. Is there a construct in mysql that can create

Re: Unique on non null entries but allowing multiple nulls

2011-10-17 Thread Jigal van Hemert
Hi, On 17-10-2011 15:39, Peng Yu wrote: If I use NULL UNIQUE when I create a table, it seems that only one NULL entry is allowed. Since NULL could mean unknown, in this case, two unknowns are not the same and I want to allow multiple nulls but I still want non null entries be unique

Null Output Problem

2011-10-11 Thread Jon Forsyth
Hello, I have a problem with the following query: SELECT subject_identifier, COUNT(*) FROM asr_sentence_score WHERE total_words = correct_words GROUP BY subject_identifier; OutPut: ++--+ | subject_identifier | COUNT(*) | ++--+ |

Re: Null Output Problem

2011-10-11 Thread Hal�sz S�ndor
is the name given COUNT(*) in the query with COUNT(*). This yields at least one row for every one in table-of-identifiers, whether there is a match in query with COUNT or not; if not, c is NULL, and with IFNULL that NULL is made 0. You write test-taker, but for a field that could be the foregoing

Re: NULL-safe (in)equality =; overloaded NULL

2011-10-04 Thread Hal�sz S�ndor
2011/10/02 15:01 +0200, Jigal van Hemert You are not using NULL as the original concept of it was. NULL means that the value is undefined or unknown. That is quite true, especially in a table. But, almost from the beginning, NULL was overloaded: set @m = (select sins from emailinglist where

Re: NULL-safe (in)equality =

2011-10-02 Thread Jigal van Hemert
Hi, On 1-10-2011 21:51, Halász Sándor wrote: It is, of course, generally considered more natural to make equality primary, not inequality, but that symbol that MySQL uses for NULL-safe equality,=, looks much more like inequality than equality. The whole concept and the name of this operator

NULL-safe (in)equality =

2011-10-01 Thread Hal�sz S�ndor
It is, of course, generally considered more natural to make equality primary, not inequality, but that symbol that MySQL uses for NULL-safe equality, =, looks much more like inequality than equality. Furthermore, I find that in my code I am far oftener interested in NULL-safe _in_equality than

IS NULL returns Empty set, but I have empty items

2010-07-29 Thread Norman Khine
Hello, I don't know what I am missing, but I have this: mysql SELECT url FROM product WHERE url IS NULL; Empty set (0.05 sec) mysql SELECT url FROM product WHERE product_Id = 67; +--+ | url | +--+ | | +--+ 1 row in set (0.00 sec) what goes with this, how can i ensure

Re: IS NULL returns Empty set, but I have empty items

2010-07-29 Thread Andy Wallace
blank is not null... I'll bet if you did SELECT url FROM product WHERE url = ''; you'll get a row or three. If the field was NULL, your product_id select would look like: +--+ | url | +--+ |NULL | +--+ andy Norman Khine wrote: Hello, I don't know what I am missing, but I

Re: IS NULL returns Empty set, but I have empty items

2010-07-29 Thread Dan Nelson
In the last episode (Jul 29), Norman Khine said: I don't know what I am missing, but I have this: mysql SELECT url FROM product WHERE url IS NULL; Empty set (0.05 sec) mysql SELECT url FROM product WHERE product_Id = 67; +--+ | url | +--+ | | +--+ 1 row in set (0.00

Re: IS NULL returns Empty set, but I have empty items

2010-07-29 Thread Norman Khine
thank you, this makes sense. On Thu, Jul 29, 2010 at 11:29 PM, Dan Nelson dnel...@allantgroup.com wrote: In the last episode (Jul 29), Norman Khine said: I don't know what I am missing, but I have this: mysql SELECT url FROM product WHERE url IS NULL; Empty set (0.05 sec) mysql SELECT url

RE: Particular value or NULL

2010-03-11 Thread Jerry Schwartz
-infoshop.com -Original Message- From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br] Sent: Wednesday, March 10, 2010 2:10 PM To: mysql@lists.mysql.com Subject: Re: Particular value or NULL Did you gave a try on using coalesce in your query? Jerry Schwartz jschwa...@the-infoshop.com

Re: Particular value or NULL

2010-03-11 Thread Joerg Bruehe
Hi Jerry, all! Jerry Schwartz wrote: [[...]] Maybe: WHERE coalesce(x, 17) = 17 [JS] Interesting suggestion, but us-gii select benchmark(1000,(7=7 or null is null)); [[...]] 1 row in set (0.34 sec) us-gii select benchmark(1,coalesce(null,7)); [[...]] 1 row in set

Particular value or NULL

2010-03-10 Thread Jerry Schwartz
Is there a better construct for the WHERE clause in a LEFT JOIN than WHERE (x = 17 OR x IS NULL) ? Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 http://www.the

Re: Particular value or NULL

2010-03-10 Thread Jo�o C�ndido de Souza Neto
Maybe: WHERE coalesce(x, 17) = 17 Jerry Schwartz jschwa...@the-infoshop.com escreveu na mensagem news:023301cac069$366afa00$a340ee...@com... Is there a better construct for the WHERE clause in a LEFT JOIN than WHERE (x = 17 OR x IS NULL) ? Regards, Jerry Schwartz

RE: Particular value or NULL

2010-03-10 Thread Jerry Schwartz
-Original Message- From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br] Sent: Wednesday, March 10, 2010 10:55 AM To: mysql@lists.mysql.com Subject: Re: Particular value or NULL Maybe: WHERE coalesce(x, 17) = 17 [JS] Interesting suggestion, but us-gii select benchmark

Re: Particular value or NULL

2010-03-10 Thread Jo�o C�ndido de Souza Neto
To: mysql@lists.mysql.com Subject: Re: Particular value or NULL Maybe: WHERE coalesce(x, 17) = 17 [JS] Interesting suggestion, but us-gii select benchmark(1000,(7=7 or null is null)); +---+ | benchmark(1000,(7=7 or null is null

Re: Particular value or NULL

2010-03-10 Thread Martijn Tonies
Maybe: WHERE coalesce(x, 17) = 17 [JS] Interesting suggestion, but us-gii select benchmark(1000,(7=7 or null is null)); +---+ | benchmark(1000,(7=7 or null is null

How to force Warning: #1048 Column cannot be null to Error

2010-01-30 Thread Miao Jiang
When I try insert NULL to VARCHAR NOT NULL column, It will shows a warning and convert NULL to '' then insert 。 I want to MySQL raise an exception when I try do that. How to do that? Thank you. Miao -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe

Re: How to force Warning: #1048 Column cannot be null to Error

2010-01-30 Thread Claudio Nanni
Take a look at SQL_MODE ;) Claudio On Jan 30, 2010 5:05 PM, Miao Jiang jiangfri...@gmail.com wrote: When I try insert NULL to VARCHAR NOT NULL column, It will shows a warning and convert NULL to '' then insert 。 I want to MySQL raise an exception when I try do that. How to do that? Thank you

Re: How to force Warning: #1048 Column cannot be null to Error

2010-01-30 Thread Wagner Bianchi
Jiang jiangfri...@gmail.com wrote: When I try insert NULL to VARCHAR NOT NULL column, It will shows a warning and convert NULL to '' then insert 。 I want to MySQL raise an exception when I try do that. How to do that? Thank you. Miao -- MySQL General Mailing List For list archives: http

Re: Is anything ever equal to NULL?

2009-12-29 Thread Joerg Bruehe
Martijn, thanks for your excellent mail: Martijn Tonies wrote: [[...]] A column can have two states: null or not null. It either has data (a value, depending on the datatype), or no data (null), which is where column IS NULL (has no data) or column IS NOT NULL (has data) comes into play

Is anything ever equal to NULL?

2009-12-28 Thread D. Dante Lorenso
Will anything ever be equal to NULL in a SELECT query? SELECT * FROM sometable WHERE somecolumn = NULL; I have a real-life query like this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; The 'sometable' contains about 40 million records and in this query

Re: Is anything ever equal to NULL?

2009-12-28 Thread Michael Dykman
No, nothing will ever equal null. In strict relational theory, which I don't know well enough to begin expounding on here, null does not even equal another null. That's why SQL provides IS NULL and IS NOT NULL as explicit cases. - michael dykman On Mon, Dec 28, 2009 at 2:32 PM, D. Dante

Re: Is anything ever equal to NULL?

2009-12-28 Thread David Giragosian
On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso da...@lorenso.com wrote: Will anything ever be equal to NULL in a SELECT query? SELECT * FROM sometable WHERE somecolumn = NULL; I have a real-life query like this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn

Re: Is anything ever equal to NULL?

2009-12-28 Thread Martijn Tonies
Hi, Will anything ever be equal to NULL in a SELECT query? No, never. Null also means unknown, if you design your tables well enough, there should be no NULLs -stored- (different from a resultset, where there can be nulls, for example in LEFT JOINs), because it's no use to store what you

Re: Is anything ever equal to NULL?

2009-12-28 Thread Carsten Pedersen
David Giragosian skrev: On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso da...@lorenso.com wrote: Will anything ever be equal to NULL in a SELECT query? ... What's so special about NULL? http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html Should answer some of your questions

Re: Is anything ever equal to NULL?

2009-12-28 Thread David Giragosian
On Mon, Dec 28, 2009 at 5:41 PM, Carsten Pedersen cars...@bitbybit.dkwrote: David Giragosian skrev: On Mon, Dec 28, 2009 at 2:32 PM, D. Dante Lorenso da...@lorenso.com wrote: Will anything ever be equal to NULL in a SELECT query? ... What's so special about NULL? http

Re: Is anything ever equal to NULL?

2009-12-28 Thread D. Dante Lorenso
Well, if nothing can ever equal null, then why isn't MySQL query parser smart enough to reduce my queries to something more sensible? If I'm saying this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; Why isn't it able to reduce the query to something more like

Re: Is anything ever equal to NULL?

2009-12-28 Thread Martijn Tonies
Well, if nothing can ever equal null, then why isn't MySQL query parser smart enough to reduce my queries to something more sensible? If I'm saying this: SELECT * FROM sometable WHERE somecolumn = NULL OR somecolumn = 'abc'; Why isn't it able to reduce the query to something more

Effect of NULL on index performance specific to InnoDB

2009-06-01 Thread Kyong Kim
It's often said that NOT NULL column is preferable in terms of index performance. I was wondering exactly why and how this is so specifically to InnoDB. It would be great if someone can shed light on this matter in some detail. Kyong -- MySQL General Mailing List For list archives: http

Inserting a default null date

2009-05-15 Thread Octavian Rasnita
Hi, I have a table with a column like: date date default null, If I enter an empty string in it, the default null value is added (as it should). But if I enter an invalid date by mistake, the date -00-00 date date is entered instead of the default null, and this is not good. Can I do

Re: Inserting a default null date

2009-05-15 Thread Janek Bogucki
Hi Octavian, One approach is to use a trigger, mysql set sql_mode = ''; mysql create table temp_date(d date default null); mysql create trigger temp_date_bi before insert on temp_date for each row set new.d = if(new.d = '-00-00', null, new.d); mysql insert into temp_date(d) values('2009

Re: Inserting a default null date

2009-05-15 Thread Martijn Tonies
Hi, I have a table with a column like: date date default null, If I enter an empty string in it, the default null value is added (as it should). But if I enter an invalid date by mistake, the date -00-00 date date is entered instead of the default null, and this is not good. Can I

RE: Inserting a default null date

2009-05-15 Thread Andrew Braithwaite
Agreed. And don't forget to listen to the warnings MySQL sends back, e.g.: mysql create table temp_date(d date default null); Query OK, 0 rows affected (0.15 sec) mysql insert into temp_date(d) values('2009-13-99'); Query OK, 1 row affected, 1 warning (0.00 sec) mysql show warnings

How to change where NULL values sort?

2009-04-18 Thread David M. Karr
I think normally NULL values will sort at the end, correct? I believe there's a way to make NULL values sort at the beginning, but I can't remember how to do it. I just searched a couple of MySQL resources, but I couldn't find it. -- MySQL General Mailing List For list archives: http

Re: How to change where NULL values sort?

2009-04-18 Thread Martijn Engler
They'll normally sort at the top, unless you use ORDER BY DESC. Anyway, fixing that is easy: SELECT col1, col1 IS NULL AS isnull FROM tbl1 ORDER BY isnull DESC, col1 ASC That should give you the results ordered by col1, with the null-values at the top. - Martijn On Sat, Apr 18, 2009 at 19:54

InnoDB best practices for ensuring unique tuple where one column can be NULL

2009-04-16 Thread Lev Lvovsky
hello, assume the following table: CREATE TABLE t ( id INT UNSIGNED auto_increment PRIMARY KEY, c1 INT UNSIGNED NOT NULL, c2 INT UNSIGNED NOT NULL, c3 INT UNSIGNED, UNIQUE (c1, c2, c3) ) engine = InnoDB; Our first issue is that the UNIQUE constraint on (c1,c2,c3) does not work in the case

Re: facing problem with is null in stored procedure

2009-04-12 Thread syed basha
convertion(p_unit,v_bhunit,p_item,p_size,p_quantity,v_conqty); set v_calqty=v_conqty*v_blqty; if v_puid is not null then set v_mess='max id is exists'; else insert into prplrawm(ppid,plid,item,szid,rawm,rqty,runt) values(p_autoincrement,v_plid,p_item,p_size,v_blrawm,v_blrqty,v_blrunt); set

Re: facing problem with is null in stored procedure

2009-04-11 Thread Shawn Green
prpllins); open c_bomdet; repeat fetch c_bomdet into v_bhqty,v_bhunit,v_blrawm,v_blqty,v_blunit; if not done then call convertion(p_unit,v_bhunit,p_item,p_size,p_quantity,v_conqty); set v_calqty=v_conqty*v_blqty; if v_puid is not null then set v_mess='max id is exists'; else insert into prplrawm

facing problem with is null in stored procedure

2009-04-09 Thread syed basha
; repeat fetch c_bomdet into v_bhqty,v_bhunit,v_blrawm,v_blqty,v_blunit; if not done then call convertion(p_unit,v_bhunit,p_item,p_size,p_quantity,v_conqty); set v_calqty=v_conqty*v_blqty; if v_puid is not null then set v_mess='max id is exists'; else insert into prplrawm(ppid,plid,item,szid

Re: how to check for null in string

2009-02-17 Thread Johan De Meersman
In SQL, the correct syntax is IS NULL or IS NOT NULL. Random programming languages more often than not have no decent support for NULL content, although your DB library might have an isnull() function or something similar. Once you've exported a field into a regular variable, however, most often

Re: how to check for null in string

2009-02-17 Thread Joerg Bruehe
Hi ! Johan De Meersman wrote: In SQL, the correct syntax is IS NULL or IS NOT NULL. Random programming languages more often than not have no decent support for NULL content, although your DB library might have an isnull() function or something similar. Once you've exported a field

Re: how to check for null in string

2009-02-17 Thread PJ
Johan De Meersman wrote: In SQL, the correct syntax is IS NULL or IS NOT NULL. Random programming languages more often than not have no decent support for NULL content, although your DB library might have an isnull() function or something similar. Once you've exported a field into a regular

how to check for null in string

2009-02-16 Thread PJ
I know this is not working, but how can I check for NULL; or how can I configure my field sub_title so I can check if $booksub_title contains anything or is empty. This problem as been breaking my back...don't know what to put in as a default to be able to check against string input (VARCHAR

Function returns null when running sql manually works

2008-11-13 Thread Cantwell, Bryan
Below I have a function with a cursor. I have tested the cursor sql manually and it is fine, I have put the variables into the sql inside the cursor loop and it returns data too, BUT, executing this function returns null even though I know the correct info is available. Am I missing something

RE: Function returns null when running sql manually works

2008-11-13 Thread Cantwell, Bryan
OK, I know WHY it is returning null, just not WHAT to do about it. In the inside sql, there is not always a result. So, done becomes 1 and the repeat exits. How can I keep from this happening? How could I make another 'done' like variable that would not get also set to 1 if the inner sql doesn't

RE: Function returns null when running sql manually works

2008-11-13 Thread Cantwell, Bryan
report_filters rvf WHERE rvf.report_id = RepID AND rvf.report_column_id = colID; IF filterTMP IS NOT NULL THEN IF filterSQL IS NULL THEN SELECT filterTMP INTO filterSQL; ELSE

Re: use of wildcards or regular expressions in IFNULL, how to create a view that substitutes NULL by 0?

2008-09-06 Thread Brent Baisley
should probably be records with a column indicating what type of data it is. Brent Baisley On Sep 4, 2008, at 5:11 AM, drflxms wrote: Dear MySQL specialists, this is a MySQL-newbie question: I want to create a view of a table, where all NULL-values are substituted by 0. Therefore I tried

use of wildcards or regular expressions in IFNULL, how to create a view that substitutes NULL by 0?

2008-09-04 Thread drflxms
Dear MySQL specialists, this is a MySQL-newbie question: I want to create a view of a table, where all NULL-values are substituted by 0. Therefore I tried: SELECT *, IFNULL(*,0) FROM table Unfortunately IFNULL seems not to accept any wildcards like * as placeholder for the column-name. REGEXP

SELECT in NULL state for a long time

2008-08-14 Thread Vlad Shalnev
Hi, OS - Solaris 10, 32 Gb RAM, mysql 64-bit 4.1.22 Every day I see in processlist many SELECT queries that stay in NULL state for a long time. Something Like this | 368966 | radius | fire-u1:35671 | srg_conf | Query | 106 | NULL |SELECT id, deleted_id, status, name

Re: SELECT in NULL state for a long time

2008-08-14 Thread Krishna Chandra Prajapati
64-bit 4.1.22 Every day I see in processlist many SELECT queries that stay in NULL state for a long time. Something Like this | 368966 | radius | fire-u1:35671 | srg_conf | Query | 106 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM s | 368967

RE: SELECT in NULL state for a long time

2008-08-14 Thread Martin Gainty
and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Thu, 14 Aug 2008 17:35:00 +0530 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: SELECT in NULL state for a long time CC

default, Nullable and NULL : confused

2008-07-16 Thread Gilles MISSONNIER
Hello, I do not understand the behavior of a simple table : from what I red, in the following exemple the Null column tells the value can be set to NULL, and the Default value is NULL. It doesn't seem to work that way. Some one could explain it ? I run on a linux debian/etch 5.0.32 MySQL

Re: default, Nullable and NULL : confused

2008-07-16 Thread Ananda Kumar
in your data file use this for inserting null values '\N' 0.12345;qwer 1.2345;\N \N;asdf On 7/17/08, Gilles MISSONNIER [EMAIL PROTECTED] wrote: Hello, I do not understand the behavior of a simple table : from what I red, in the following exemple the Null column tells the value can be set

SELECT to return 0 instead of NULL?

2008-05-23 Thread Tuc at T-B-O-H.NET
Hi, I'm running a query : SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='hotspot'; But if there aren't any rows in radacct for the UserName of hotspot, it returns a NULL. Is there a way to change it to return 0 instead? (I can't change the application, but I can change

Re: SELECT to return 0 instead of NULL?

2008-05-23 Thread Rob Wultsch
On Fri, May 23, 2008 at 8:23 AM, Tuc at T-B-O-H.NET [EMAIL PROTECTED] wrote: Hi, I'm running a query : SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='hotspot'; But if there aren't any rows in radacct for the UserName of hotspot, it returns a NULL. Is there a way

Re: [mysql] Re: SELECT to return 0 instead of NULL?

2008-05-23 Thread Tuc at T-B-O-H.NET
On Fri, May 23, 2008 at 8:23 AM, Tuc at T-B-O-H.NET [EMAIL PROTECTED] wrote: Hi, I'm running a query : SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='hotspot'; But if there aren't any rows in radacct for the UserName of hotspot, it returns a NULL

Re: CONCAT doesn't work with NULL?

2008-05-21 Thread Afan Pasalic
this is good. though, if r.title is NULL I'll get an extra empty row on screen: john doe doe, inc. -- no title, empty row 123 main st. testtown, TE 12345 also, I would like to hear opinion about the following query: SELECT o.col1, o.col2, o.col3, ( SELECT CONCAT_WS

CONCAT doesn't work with NULL?

2008-05-14 Thread Afan Pasalic
hi, I have query SELECT CONCAT(r.first_name, ' ', r.last_name, '\n', r.organization, '\n', r.title, '\n', a.address1, '\n', a.city, ', ', a.state, ' ', a.zip, '\n', r.email) FROM registrants r, addresses a WHERE r.reg_id=121 if any of columns has value (e.g. title) NULL, I'll get as result 0

Re: CONCAT doesn't work with NULL?

2008-05-14 Thread Olexandr Melnyk
It doesn't return no rows, it returns row(s) with a single column set to a NULL value. In case one of the arguments is NULL, CONCAT() will return NULL. To replace the value of one of the fields with an empty string when it's NULL, you can use something like: CONCAT(COAESCE(a, ''), ' ', COAESCE(b

Re: CONCAT doesn't work with NULL?

2008-05-14 Thread ewen fortune
Hi Afan, You can use concat_ws http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws --- CONCAT() returns NULL if any argument is NULL. CONCAT_WS() does not skip empty strings. However, it does skip any NULL values after the separator argument --- Ewen On Wed, May 14

Re: CONCAT doesn't work with NULL?

2008-05-14 Thread wim . delvaux
On Wednesday 14 May 2008 18:02:42 Olexandr Melnyk wrote: It doesn't return no rows, it returns row(s) with a single column set to a NULL value. In case one of the arguments is NULL, CONCAT() will return NULL. To replace the value of one of the fields with an empty string when it's NULL, you

RE: CONCAT doesn't work with NULL?

2008-05-14 Thread Price, Randall
work with NULL? hi, I have query SELECT CONCAT(r.first_name, ' ', r.last_name, '\n', r.organization, '\n', r.title, '\n', a.address1, '\n', a.city, ', ', a.state, ' ', a.zip, '\n', r.email) FROM registrants r, addresses a WHERE r.reg_id=121 if any of columns has value (e.g. title) NULL, I'll get

Re: CONCAT doesn't work with NULL?

2008-05-14 Thread Afan Pasalic
Thanks Ewen, that's what I was looking for! :D -afan ewen fortune wrote: Hi Afan, You can use concat_ws http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws --- CONCAT() returns NULL if any argument is NULL. CONCAT_WS() does not skip empty strings. However, it does

Re: CONCAT doesn't work with NULL?

2008-05-14 Thread Afan Pasalic
Pratt Drive Blacksburg, VA 24060 -Original Message- From: Afan Pasalic [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 14, 2008 11:53 AM To: mysql@lists.mysql.com Subject: CONCAT doesn't work with NULL? hi, I have query SELECT CONCAT(r.first_name, ' ', r.last_name, '\n', r.organization

Re: CONCAT doesn't work with NULL?

2008-05-14 Thread Afan Pasalic
/5.0/en/string-functions.html#function_concat-ws --- CONCAT() returns NULL if any argument is NULL. CONCAT_WS() does not skip empty strings. However, it does skip any NULL values after the separator argument --- Ewen On Wed, May 14, 2008 at 5:53 PM, Afan Pasalic [EMAIL PROTECTED] wrote: hi, I

  1   2   3   4   5   6   7   8   9   10   >