Solved

Select within select

Posted on 2014-04-01
2
255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

730 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