Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 4 of 4 total |
Diffrent Columns Per Row |
Tue, Feb 7 2006 10:13 AM | Permanent Link |
Stuart Kelly | I was wondering if the following was possible
We use a table called SIZESLIST which has a OFFSET field and ten other fields named NAME_0, NAME_1 ... NAME_9 Can I select the correct one per row based on the offset using SQL. Example: SELECT #EVALUATE("NAME_"+OFFSET")#, PRODUCT_ID, OFFSET FROM PRODUCT INNER JOIN SIZESLIST ON (SIZESLIST.SIZE_ID = PRODUCT.SIZE_ID) Would return the correct name field for a given offset. Would I need to write a custom function for this? Thanks Stuart |
Tue, Feb 7 2006 10:38 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Stuart
You could use IF or CASE for it eg IF(OFFSET= 0 THEN NAME_0 ELSE IF(OFFSET = 1 THEN NAME_1)) etc etc Roy Lambert |
Tue, Feb 7 2006 11:19 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Stuart,
<< Can I select the correct one per row based on the offset using SQL. Example: SELECT #EVALUATE("NAME_"+OFFSET")#, PRODUCT_ID, OFFSET FROM PRODUCT INNER JOIN SIZESLIST ON (SIZESLIST.SIZE_ID = PRODUCT.SIZE_ID) Would return the correct name field for a given offset. >> Use the CASE operator: SELECT CASE OFFSET WHEN 1 THEN NAME_1 WHEN 2 THEN NAME_2 etc. AS OFFSET, PRODUCT_ID, OFFSET FROM PRODUCT INNER JOIN SIZESLIST ON (SIZESLIST.SIZE_ID = PRODUCT.SIZE_ID) -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Feb 8 2006 3:23 AM | Permanent Link |
Stuart Kelly | << Use the CASE operator: >>
Thanks you both, this really helped. Stuart ;o) |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |