Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rows to column
Message
 
 
To
01/03/2015 14:24:52
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01616010
Message ID:
01616037
Views:
46
>Thank you but...
>I found this on the net:
>Table(A) can be transposed to table(B)
>
>(A)
>Number time amount
>1 1 63,52
>1 2 87,52
>1 3 42,56
>2 1 7,8
>2 2 6,07
>2 3 98,5
>
>(B)
>1 2 3
>63,52 87,52 42,56
>7,8 6,07 98,5
>
>by using this sql select:
>
>
>select max(iif(Time = 1, Amount,cast(0 as N(10)) as [a1],;
>max(iif(Time = 2, Amount,cast(0 as N(10)) as [a2],;
>max(iif(Time = 3, Amount,cast(0 as N(10)) as [a3];
>from myTable;
>GROUP BY Number
>
>
>It would be perfect but when I tried and it worked unfortunately only with positive numbers.
>When "Amount" is a negative number, it results 0.
>Any help?

Just use big negative number instead of cast(0 as N(10)) in this case. E.g. assuming you never have something like this
-9999999999 in a table.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform