using if block without using procedures...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

using if block without using procedures...

Post by raghavan20 »

I want to use a if like statment or ternary operator to make a logical decision but I am not interested to write procedures.

Let's say I get a whether the requested quantity is greater than available quantity from a select statement and store it into a variable and then I have to make assignment statements based on what value is returned.

for ex:
requested quantity = 3
available quantity = 4

if requested quantity < available quantity
final quantity = requested quantity
else
final quantity = available quantity

this logic has to be someway made into mysql logical statements...thanks for any ideas...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

is the IF() construct that confusing?
Post Reply