Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tricky SELECT query question?
Message
From
30/09/1998 07:35:41
 
 
To
30/09/1998 07:25:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00142244
Message ID:
00142291
Views:
21
>>Hi,
>> Iam trying to extract certain fields from a table.
>>Suppose I have a table with three fileds
>>Shipper, Receiver and type
>>
>>My query should return rows with one column such that if
>>type is 1, it should return flat string "TYPE 1", otherwise, it should return Receiver.
>>Suppose my data is like
>>
>>"Shipper1", "Receiver1", 1
>>"Shipper2", "Receiver2", 2
>>"Shipper3", "Receiver3", 1
>>
>>And the query should return
>>"TYPE 1"
>>"Receiver2"
>>"TYPE 1"
>>
>>How to write an sql query for this?
>>
>>Thanks
>>Puri
>
>Hi Puri,
>
>your query should be like this:
>
>Select IIf( Type = 1, "Type 1", Receiver ) As YourColumn From YourTable Into Cursor YourView
>
>Sincerely
>Petr Valach

In addition to what Petr here correctly suggests, it is worth mentioning that you should PAD() "Type 1" text to the same width as your Reciever-field, otherwise you'll end up with column width from the first record in the resulting query
Danijel
Previous
Reply
Map
View

Click here to load this message in the networking platform