dbTalk Databases Forums  

In need of correct syntax to complete the query

comp.databases.btrieve comp.databases.btrieve


Discuss In need of correct syntax to complete the query in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jag
 
Posts: n/a

Default In need of correct syntax to complete the query - 08-11-2006 , 09:09 AM






I have an existing view that is working. The problem is that I need
to add one more piece of information to the view and I don't know how
to accomplish this with Pervasive. The existing view is:

SELECT
DISTINCT "T2" ."ORDNUM_27" ,"T2" ."STATUS_27" ,"T2" ."CUSTPO_27" ,"T2"
.."SHPVIA_27"
,"T2" ."NAME_27" ,"T2" ."ADDR1_27" ,"T2" ."ADDR2_27" ,"T2" ."CITY_27"
,"T2" ."STATE_27"
,"T2" ."ZIPCD_27" ,"T2" ."CNTRY_27" ,"T2" ."PHONE_27" ,"T2" ."CNTCT_27
" ,"T1" ."EMAIL1_81"
,"T1" ."EMAIL2_81" ,("T1" ."EMAIL1_81" +"T1" ."EMAIL2_81" )"EMAIL"
FROM "Customer VAT"
"T1" ,"SO Master" "T2" WHERE "T1" ."CUSTID_81" = "T2" ."CUSTID_27"
AND "T2" ."STATUS_27" =
'3'

I need to add a return of 'Y' if there is an email address and the
return of 'N' if there is not.

Here's how it works using Access:
EMAILFLAG1: IIf([emailaddress] Like '*@*',1) ----->Where
[emailaddress] = the column name

and using MS SQL:
CASE WHEN emailaddress like `%@%' THEN `Y' else `N ` END AS EMAILflag
FROM orders GO


Can anyone tell me how it should look for Pervasive?
Thanks for anything,
Jag


Reply With Quote
  #2  
Old   
Wayne
 
Posts: n/a

Default Re: In need of correct syntax to complete the query - 08-11-2006 , 07:57 PM






Try this:

include emailaddress in the select, then:
CASE
WHEN emailaddress LIKE '%@%' THEN 'Y'
ELSE 'N'
END
as 'EmailFlag'
FROM orders;

Wayne Freeman
www.analyticabiz.com
Analytica Business Systems, Inc.
A Premier Pervasive Partner

To subscribe to our Pervasive news feed:
www.analyticabiz.com/rss20.php

jag wrote:
Quote:
I have an existing view that is working. The problem is that I need
to add one more piece of information to the view and I don't know how
to accomplish this with Pervasive. The existing view is:

SELECT
DISTINCT "T2" ."ORDNUM_27" ,"T2" ."STATUS_27" ,"T2" ."CUSTPO_27" ,"T2"
."SHPVIA_27"
,"T2" ."NAME_27" ,"T2" ."ADDR1_27" ,"T2" ."ADDR2_27" ,"T2" ."CITY_27"
,"T2" ."STATE_27"
,"T2" ."ZIPCD_27" ,"T2" ."CNTRY_27" ,"T2" ."PHONE_27" ,"T2" ."CNTCT_27
" ,"T1" ."EMAIL1_81"
,"T1" ."EMAIL2_81" ,("T1" ."EMAIL1_81" +"T1" ."EMAIL2_81" )"EMAIL"
FROM "Customer VAT"
"T1" ,"SO Master" "T2" WHERE "T1" ."CUSTID_81" = "T2" ."CUSTID_27"
AND "T2" ."STATUS_27" =
'3'

I need to add a return of 'Y' if there is an email address and the
return of 'N' if there is not.

Here's how it works using Access:
EMAILFLAG1: IIf([emailaddress] Like '*@*',1) ----->Where
[emailaddress] = the column name

and using MS SQL:
CASE WHEN emailaddress like `%@%' THEN `Y' else `N ` END AS EMAILflag
FROM orders GO


Can anyone tell me how it should look for Pervasive?
Thanks for anything,
Jag


Reply With Quote
  #3  
Old   
Bill Bach
 
Posts: n/a

Default Re: In need of correct syntax to complete the query - 08-16-2006 , 05:07 PM



Or the simpler in-line IF statement:
if(emailaddress LIKE '%@%','Y','N')


Wayne wrote:

Quote:
Try this:

include emailaddress in the select, then:
CASE
WHEN emailaddress LIKE '%@%' THEN 'Y'
ELSE 'N'
END
as 'EmailFlag'
FROM orders;

Wayne Freeman
www.analyticabiz.com
Analytica Business Systems, Inc.
A Premier Pervasive Partner

To subscribe to our Pervasive news feed:
www.analyticabiz.com/rss20.php

jag wrote:
I have an existing view that is working. The problem is that I need
to add one more piece of information to the view and I don't know
how to accomplish this with Pervasive. The existing view is:

SELECT
DISTINCT "T2" ."ORDNUM_27" ,"T2" ."STATUS_27" ,"T2" ."CUSTPO_27"
,"T2" ."SHPVIA_27"
,"T2" ."NAME_27" ,"T2" ."ADDR1_27" ,"T2" ."ADDR2_27" ,"T2"
."CITY_27" ,"T2" ."STATE_27"
,"T2" ."ZIPCD_27" ,"T2" ."CNTRY_27" ,"T2" ."PHONE_27" ,"T2"
."CNTCT_27 " ,"T1" ."EMAIL1_81"
,"T1" ."EMAIL2_81" ,("T1" ."EMAIL1_81" +"T1" ."EMAIL2_81" )"EMAIL"
FROM "Customer VAT"
"T1" ,"SO Master" "T2" WHERE "T1" ."CUSTID_81" = "T2" ."CUSTID_27"
AND "T2" ."STATUS_27" =
'3'

I need to add a return of 'Y' if there is an email address and the
return of 'N' if there is not.

Here's how it works using Access:
EMAILFLAG1: IIf([emailaddress] Like '*@*',1) ----->Where
[emailaddress] = the column name

and using MS SQL:
CASE WHEN emailaddress like `%@%' THEN `Y' else `N ` END AS
EMAILflag FROM orders GO


Can anyone tell me how it should look for Pervasive?
Thanks for anything,
Jag


Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.