Solved

Select within select

Posted on 2014-04-01
2
252 Views
Last Modified: 2014-04-01
Select
  name, address, sales
from
  data
where
  sales > 100k

Returns records where sales are greater than 100k.

What if I want to see everyone but only the sales if they are more than 100k:

Select
  name, address, sales if sales > 100k
from
  data

Possible with Pervasive?
0
Comment
Question by:classnet
2 Comments
 
LVL 9

Accepted Solution

by:
Sreedhar Vengala earned 500 total points
ID: 39970750
Do you mean want to show all records and the Sales Values only if greater than 100k?

You can have a case in your select for Sales column to check if its greater than 100k then show sales figure if not show 'NULL' or '' (emtpy string) or '0' (Zero).

Example:

  SELECT    Name ,
            ADDRESS ,
            ( CASE WHEN Sales > 100000 THEN Sales
                   ELSE NULL
              END ) AS Sales
  FROM      Data

Open in new window

0
 

Author Closing Comment

by:classnet
ID: 39970817
Thank you!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question