Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Select within select

Posted on 2014-04-01
2
Medium Priority
?
263 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
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.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

597 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