Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 29th, 2006, 10:11 PM
janyu86 janyu86 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 32 janyu86 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 15 m 40 sec
Reputation Power: 3
Question VB - Firebird If-Else

How do I use If-Else statements in VB-Firebird?

Example:
SELECT tr_dir, tr_time FROM transaction;

I want...
IF (tr_dir=1) min(tr_time) is returned
else if (tr_dir=0) max(tr_time) is returned.

Reply With Quote
  #2  
Old May 30th, 2006, 02:48 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,824 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 1 Day 8 h 35 m 21 sec
Reputation Power: 278
Yours looks like a more complex query, post some sample data and expected results and choose if you want this done at database level or at application level.

Reply With Quote
  #3  
Old June 6th, 2006, 11:10 PM
janyu86 janyu86 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 32 janyu86 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 15 m 40 sec
Reputation Power: 3
Quote:
Originally Posted by pabloj
Yours looks like a more complex query, post some sample data and expected results and choose if you want this done at database level or at application level.


database level

Reply With Quote
  #4  
Old June 19th, 2006, 12:54 AM
tom67ro tom67ro is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 3 tom67ro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 46 sec
Reputation Power: 0
Quote:
Originally Posted by janyu86
How do I use If-Else statements in VB-Firebird?

Example:
SELECT tr_dir, tr_time FROM transaction;

I want...
IF (tr_dir=1) min(tr_time) is returned
else if (tr_dir=0) max(tr_time) is returned.


try this

dim x as long (double, etc)

"SELECT IIF(tr_dir=1,MIN(tr_time),MAX(tr_time)) _Value FROM transaction WHERE tr_dir= " & x

if x as string

dim x as string

"SELECT IIF(tr_dir=1,MIN(tr_time),MAX(tr_time)) _Value FROM transaction WHERE tr_dir= ' " & x & " ' "


Best regards,

Tom

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > VB - Firebird If-Else


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway