Re: Conditional ODER BY Clause HELP

2016-03-21 Thread Hal.sz S.ndor
2016/03/18 12:54 ... Don Wieland: Trying to get the correct syntax on this: ORDER BY CASE WHEN tr.Placed = "X" THEN r.Division ASC, FIELD(tr.Place,"1","2","3","4","5","6","7","8","R","WD","Exc","E","S”), tr.Score DESC WHEN tr.Placed != "X" THEN tr.ride_time ASC END How does

Re: Conditional in update

2014-02-12 Thread hsv
2014/02/11 18:14 -0500, Larry Martell set LIMIT = sign(LIMIT) * 100 * floor(0.01 + (sign(LIMIT) * LIMIT * ratio/100) The function TRUNCATE can be useful here: set LIMIT = TRUNCATE(LIMIT * ratio + 0.01 * sign(LIMIT), -2) , if it works as advertized. In any case, ABS(LIMIT) = sign(LIMIT)

Re: Conditional in update

2014-02-12 Thread Larry Martell
On Wed, Feb 12, 2014 at 5:35 PM, h...@tbbs.net wrote: 2014/02/11 18:14 -0500, Larry Martell set LIMIT = sign(LIMIT) * 100 * floor(0.01 + (sign(LIMIT) * LIMIT * ratio/100) The function TRUNCATE can be useful here: set LIMIT = TRUNCATE(LIMIT * ratio + 0.01 * sign(LIMIT), -2) , if

Re: conditional updating

2012-02-11 Thread william drescher
On 2/9/2012 8:58 AM, Reindl Harald wrote: Am 09.02.2012 14:55, schrieb william drescher: On 2/9/2012 8:22 AM, Johnny Withers wrote: Update table set mydate=now() where mydate='-00-00'; should do it. can't do that because the record is selected by other criteria. so explain the

Re: conditional updating

2012-02-09 Thread Michael Dykman
untested: update set mydate = IF(mydate =  '-00-00', now(), mydate) - michael dykman On Thu, Feb 9, 2012 at 8:14 AM, william drescher will...@techservsys.com wrote: I want to update a date field in a record. if the date in the field is -00-00 I want to change it to the current

Re: conditional updating

2012-02-09 Thread Johnny Withers
Update table set mydate=now() where mydate='-00-00'; should do it. Sent from my iPad On Feb 9, 2012, at 7:15 AM, william drescher will...@techservsys.com wrote: I want to update a date field in a record. if the date in the field is -00-00 I want to change it to the current date. I

Re: conditional updating

2012-02-09 Thread william drescher
On 2/9/2012 8:22 AM, Johnny Withers wrote: Update table set mydate=now() where mydate='-00-00'; should do it. can't do that because the record is selected by other criteria. Thanks bill -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: conditional updating

2012-02-09 Thread Reindl Harald
Am 09.02.2012 14:55, schrieb william drescher: On 2/9/2012 8:22 AM, Johnny Withers wrote: Update table set mydate=now() where mydate='-00-00'; should do it. can't do that because the record is selected by other criteria. so explain the criteria, show us the query usually you do exatcly

Re: conditional updating

2012-02-09 Thread william drescher
On 2/9/2012 8:18 AM, Michael Dykman wrote: untested: update set mydate = IF(mydate = '-00-00', now(), mydate) - michael dykman Thank you very much ! bill On Thu, Feb 9, 2012 at 8:14 AM, william drescher will...@techservsys.com wrote: I want to update a date field in a

Re: conditional updating

2012-02-09 Thread Johnny Withers
So, add your other criteria to the where clause, you failed to say there were other conditions in your first email. Sent from my iPad On Feb 9, 2012, at 7:56 AM, william drescher will...@techservsys.com wrote: On 2/9/2012 8:22 AM, Johnny Withers wrote: Update table set mydate=now() where

Re: conditional updating

2012-02-09 Thread Michael Dykman
He did mention that there was another field he was updating, which implies that the state of the date field was not the only condition. - michael On Thu, Feb 9, 2012 at 9:22 AM, Johnny Withers joh...@pixelated.net wrote: So, add your other criteria to the where clause, you failed to say there

Re: conditional updating

2012-02-09 Thread Johnny Withers
It implied to me there were two fields to update based on the date being a given value. Read it how you like. Sent from my iPad On Feb 9, 2012, at 9:34 AM, Michael Dykman mdyk...@gmail.com wrote: He did mention that there was another field he was updating, which implies that the state of the

RE: Conditional join of tow tables

2010-09-07 Thread Travis Ard
Does this work? select * from t1 join t2 on (t1.datum = t2.sdat or dayname(t1.datum) = t2.tag); -Travis -Original Message- From: mysql [mailto:my...@ayni.com] Sent: Tuesday, September 07, 2010 1:43 AM To: mysql@lists.mysql.com Subject: Conditional join of tow tables Hi listers mysql

Re: Conditional join of tow tables

2010-09-07 Thread mysql
Hi Travis Thank you for the hint. i yesterday found the following hint, which I then followed. select t1.datum, t2.sdat. t3.tag from table as t1 left outer join table2 as t2 on t1.datum = t2.sdat left outer join table2 as t3 on dayname(t1.datum) = t3.tag Note: it does not work with inner

Re: conditional sum

2008-09-05 Thread kalin m
i got closer but i can't figure out this: individually: A) select a.job, sum(b.money) from t1 as a left join t2 as b on a.account = b.account where a.job = ca1 and b.money 0; +--+---+ | job | sum(b.money) |

Re: Conditional copy of values

2006-09-25 Thread Michael Stassen
Ravi Kumar. wrote: Dear All, I have 2 tables Table1 and Table2. In Table1 rowid is primary key and in Table2 rowid is primary key as well as foreign key (referring to rowid in Table1). There are several other columns in Table1, but Table2 has only one col - rowid. I want to insert rowid

RE: Conditional copy of values

2006-09-25 Thread Ravi Kumar.
True, but they are very slow in 4.1.14. -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Tuesday, 26 September, 2006 00:12 AM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional copy of values Ravi Kumar. wrote: Dear All, I have 2 tables

Re: Conditional copy of values

2006-09-21 Thread Gerald L. Clark
Ravi Kumar. wrote: Dear All, I have 2 tables Table1 and Table2. In Table1 rowid is primary key and in Table2 rowid is primary key as well as foreign key (referring to rowid in Table1). There are several other columns in Table1, but Table2 has only one col - rowid. Then what is the reason

RE: Conditional copy of values

2006-09-21 Thread Ravi Kumar.
duplicate rowid values T2. Thanks again. Ravi. -Original Message- From: Gerald L. Clark [mailto:[EMAIL PROTECTED] Sent: Thursday, 21 September, 2006 18:30 PM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional copy of values Ravi Kumar. wrote: Dear All, I have 2 tables

RE: Conditional Insert

2006-08-29 Thread Ravi Kumar.
and insert, another thread inserts a matching record? Do we have any alternative? Thanks, Ravi. -Original Message- From: Douglas Sims [mailto:[EMAIL PROTECTED] Sent: Tuesday, 29 August, 2006 10:48 AM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional Insert Hi Ravi Standard

Re: Conditional Insert

2006-08-29 Thread Douglas Sims
alternative? Thanks, Ravi. -Original Message- From: Douglas Sims [mailto:[EMAIL PROTECTED] Sent: Tuesday, 29 August, 2006 10:48 AM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional Insert Hi Ravi Standard SQL syntax doesn't provide for that. You could wrap the whole

Re: Conditional Insert

2006-08-29 Thread Johan Höök
Subject: Re: Conditional Insert Hi Ravi Standard SQL syntax doesn't provide for that. You could wrap the whole thing in a transaction, possibly in a stored procedure, but this would be rather awkward. However, MySQL has a command called REPLACE which I think will do exactly what you want: http

Re: Conditional Insert

2006-08-29 Thread Douglas Sims
. -Original Message- From: Douglas Sims [mailto:[EMAIL PROTECTED] Sent: Tuesday, 29 August, 2006 10:48 AM To: Ravi Kumar. Cc: mysql@lists.mysql.com Subject: Re: Conditional Insert Hi Ravi Standard SQL syntax doesn't provide for that. You could wrap the whole thing in a transaction, possibly

Re: Conditional Insert

2006-08-29 Thread Chris W
Douglas Sims wrote: Hi Ravi You are correct. I was just sitting here thinking about this after I sent that and realized that what I said was incorrect; the REPLACE command will not do what you want, because it delete a record instead of updating it, it has no way to know what the

RE: Conditional Insert

2006-08-29 Thread Ravi Kumar.
To: Johan Höök Cc: Ravi Kumar.; mysql@lists.mysql.com Subject: Re: Conditional Insert Much better. Good job. Douglas Sims [EMAIL PROTECTED] On Aug 29, 2006, at 1:26 AM, Johan Höök wrote: Hi Ravi, you can take a look at: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html which might

Re: Conditional Insert

2006-08-28 Thread Douglas Sims
Hi Ravi Standard SQL syntax doesn't provide for that. You could wrap the whole thing in a transaction, possibly in a stored procedure, but this would be rather awkward. However, MySQL has a command called REPLACE which I think will do exactly what you want:

Re: Conditional insert or update.

2005-07-20 Thread Gleb Paharenko
Hello. Please, provide more information on your's application logic. To catch events which occurs for the table use triggers. See: http://dev.mysql.com/doc/mysql/en/triggers.html Unfortunately they're available only in MySQL 5.0.x, which is still beta. Paul Halliday [EMAIL

Re: Conditional insert or update.

2005-07-20 Thread Paul Halliday
Ok, The entire table looks like this: ip | hostname | mac_current | mac_change | port_current | port_change The IP addresses are harvested via netflow (a different table) and or arpwatch (an event). This new table is to augment the current information that is within the netflow tables but

Re: Conditional statement: IF

2004-10-22 Thread Rhino
Are you trying to accomplish this in a program, a script or from the command line? If you are using a program, what language are you using? If you are using a script, what platform and shell are you using? (For example, Linux with the bash shell or Windows.) If you are using the command line,

Re: Conditional statement: IF

2004-10-22 Thread Anders Karlsson
I don't know why you want to do this, but looking at your sybtax, it seems like you come from a Sybase or SQL Server environment. What you are trying to achieve is the way it is done in Transact SQL, where the conditional statements and stuff like that which are typically used in stored

Re: Conditional statement: IF

2004-10-22 Thread Luke Venediger
Hi Anders, Thanks for that. Yes, I have come from an MSSQL environment, and I'm using .Net 1.1 with the MySQL Connector/Net. The idea behind using conditional statements was to assign a query to a business task. For example, I could write a query to handle adding items to a shopping cart. In the

Re: Conditional statement: IF

2004-10-22 Thread Anders Karlsson
That's what I though. In Transact SQL this is valid code to run on the server, and you may optionally choose to put it all into a single stored procedure. In most other databases, a stored procedure has a language that is not executable outside the procedure code itself. With MySQL there will

Re: conditional default value

2003-02-15 Thread Paul DuBois
At 14:00 -0900 2/15/03, Tim Johnson wrote: Hello All: (using MYSQL Ver 11.15 Distrib 3.23.41 for redhat-linux-gnu (i386) (RH 7.2)) I am importing text data (but in a numeric format). The customers wants 'N/A' in an empty field. Additionally: The customer wishes that if a field =

Re: conditional default value

2003-02-15 Thread Stefan Hinz
Tim, I am importing text data (but in a numeric format). The customers wants 'N/A' in an empty field. Additionally: The customer wishes that if a field = '' the default value of 'N/A' be substituted. Is this possible to do in MySQL? Documentation? AFAIK there's no way to

Re: Conditional join SQL syntax help?

2002-07-23 Thread Benjamin Pflugmann
Hi. On Mon 2002-07-08 at 22:54:09 -0700, [EMAIL PROTECTED] wrote: I'm trying to get the name of a booth or tradeshow depending on the customer_link_type (which is an ENUM) combined with the customer_link_table_id which tells me the index/id of the correct table to look in. I've tried this

RE: conditional AND

2001-07-06 Thread Jason Ward
Selectp.name fromtab_person p, tab_list l wherel.id_tab_list = 18 and ((l.id_person != 0 AND l.id_person = p.id_person) or l.id_person = 0) } -Original Message- From: franky [mailto:[EMAIL PROTECTED]] Sent: 06 July 2001 19:35 To: LIste de Mysql Subject: conditional AND Hi

RE: conditional AND

2001-07-06 Thread Jason Ward
: Jason Ward [mailto:[EMAIL PROTECTED]] Sent: 06 July 2001 19:29 To: franky; LIste de Mysql Subject: RE: conditional AND Selectp.name fromtab_person p, tab_list l wherel.id_tab_list = 18 and ((l.id_person != 0 AND l.id_person = p.id_person) or l.id_person = 0) } -Original Message

RE: conditional AND

2001-07-06 Thread Jason Ward
, if no one else replies I will give you the syntax you require. Jason -Original Message- From: franky [mailto:[EMAIL PROTECTED]] Sent: 06 July 2001 20:12 To: Jason Ward; LIste de Mysql Subject: Re: conditional AND I try it but it like the OR has no effect

Re: conditional AND

2001-07-06 Thread franky
I write this: Select p.name From tab_person p, tab_list l Where l.id_tab_list = 18 And l.id_person = 0 Or l.id_person = p.id_person i will receve all name in person table! --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-- François Boucher [EMAIL PROTECTED] ___ _ (

RE: conditional AND

2001-07-06 Thread Jason Ward
: 06 July 2001 20:19 To: Jason Ward; LIste de Mysql Subject: Re: conditional AND I write this: Select p.name From tab_person p, tab_list l Where l.id_tab_list = 18 And l.id_person = 0 Or l.id_person = p.id_person i will receve all name in person table