Board index » delphi » Local SQL challenge - for all you local SQL gurus:

Local SQL challenge - for all you local SQL gurus:

I'm using the BDE  in an application and I have a customer that needs
the following capability. (I'm looking to do this as a pure SQL
implementation if at all possible)

So... here's the quasi SQL syntax (this isn't legit. sql but you'll
get the idea)

UPDATE myTable
SET price = integer(price) + .98
WHERE
   fraction(price)  = 0.99

Basically, they want to have a SQL way to change the prices on all
items that end in .99 to .98.

Bill

----------------------
Bill Artemik
Software Engineer
Droste Consultants, Inc.
bill_AT_droste1.com

"He who procrastinates

 

Re:Local SQL challenge - for all you local SQL gurus:


Bill

How about...

UPDATE myTable
SET Price = Price - 0.01
WHERE Round(Price, 0) - Price = 0.01

Regards

MD

Quote
Bill Artemik <Bill%AT%droste1.com> wrote:
>I'm using the BDE  in an application and I have a customer that needs
>the following capability. (I'm looking to do this as a pure SQL
>implementation if at all possible)

>So... here's the quasi SQL syntax (this isn't legit. sql but you'll
>get the idea)

>UPDATE myTable
>SET price = integer(price) + .98
>WHERE
>   fraction(price)  = 0.99

>Basically, they want to have a SQL way to change the prices on all
>items that end in .99 to .98.

>Bill

>----------------------
>Bill Artemik
>Software Engineer
>Droste Consultants, Inc.
>bill_AT_droste1.com

>"He who procrastinates

Re:Local SQL challenge - for all you local SQL gurus:


This is not tested

UPDATE myTable
SET price = Cast(price as Integer ) + .98
WHERE
price - Cast(price as Integer)  = 0.99

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Local SQL challenge - for all you local SQL gurus:


Well, the two solutions worked great. Had to make a couple of mods
because of customer changes but the solution works GREAT! Thanks,
guys!

Quote
>I'm using the BDE  in an application and I have a customer that needs
>the following capability. (I'm looking to do this as a pure SQL
>implementation if at all possible)

>So... here's the quasi SQL syntax (this isn't legit. sql but you'll
>get the idea)

>UPDATE myTable
>SET price = integer(price) + .98
>WHERE
>   fraction(price)  = 0.99

>Basically, they want to have a SQL way to change the prices on all
>items that end in .99 to .98.

>Bill

>----------------------
>Bill Artemik
>Software Engineer
>Droste Consultants, Inc.
>bill_AT_droste1.com

>"He who procrastinates

----------------------
Bill Artemik
Software Engineer
Droste Consultants, Inc.
bill_AT_droste1.com

"He who procrastinates

Other Threads