Display a value in the column only if the number is greater than 1
I need to return a value in the only if column the the count is greater than 1 for the same column.
Example table:
FOOD_TYPE | Agenda | COST_TO_BUY | SELL_PRICE |
---|---|---|---|
Ice cream | Chocolate | 0.50 | 2.00 |
Ice cream | Vanilla | 0.50 | 2.00 |
Ice cream | Strawberry | 0.50 | 2.00 |
Chicken | Wings | 2.00 | 5.00 |
Bovine meat | Steaks | 8.00 | 15 h 00 |
Bovine meat | Roast | 10 h 00 | 6:00 pm |
In this example, I want to choose the POINT of FOOD_TYPE, SUM (COST_TO_BUY) AND SUM (SELL_PRICE), but I want only to select the ITEM if there is more than 1 points in the FOOD_TYPE.
I tried all kinds of grouping and even including a case statement in select it as follows:
CASE
WHEN (COUNT (DISTINCT POINT) > 1)
THEN THE POINT
ELSE "
END
However, this is denied when I group because it forces me to use the POINT as a group and I can't use the set statement in the GROUP BY because it has an aggregate function.
Help, please!
with
power as
(select food_type 'Beef', 'Steaks' article, cost_to_buy 8.00 15.00 sell_price of all the double union)
Select 'Beef', 'Roast', 10.00, 18.00 double Union all
Select 'Chicken', 'Wings', 2.00, 5.00 double Union all
Select 'Ice Cream', 'Chocolate', 0.50, 2.00 double Union all
Select "Ice Cream", "Vanilla", 0.50, 2.00 double Union all
Select "Ice Cream", "Strawberry", 0.50, 2.00 double
)
Select food_type 'Type of food. "
cases where the head (separate) over (partition food_type) > 1 then end point "Item,"
TO_CHAR (cost_to_buy, 'fm990.00') "Purchase cost"
TO_CHAR (sell_price, 'fm990.00') 'selling price '.
food
food_type desc order
Food Type | Item | Purchase cost | Sell Price |
---|---|---|---|
Ice cream | Chocolate | 0.50 | 2.00 |
Ice cream | Strawberry | 0.50 | 2.00 |
Ice cream | Vanilla | 0.50 | 2.00 |
Chicken | - | 2.00 | 5.00 |
Bovine meat | Roast | 10 h 00 | 6:00 pm |
Bovine meat | Steaks | 8.00 | 15 h 00 |
Concerning
Etbin
Tags: Database
Similar Questions
-
ORA-22813: value of the operand is greater than the limits of the system
Hello
for small query
SQL > select COMPLETION_TIME from RC_BACKUP_FILES WHERE ROWNUM < 2;
I get
ORA-22813: value of the operand is greater than the limits of the system
It seems starnge to me, you know?
I have a great value operand?
Thanks for help.The Version could help here
might be a bug
-
Browser problem to display a value in the field "display only".
I'm trying to display a value in the "Display" section only when AJAX select list is changed. This works fine in IE but not in Firefox. I created the test below page on the site of the APEX. Any ideas are appreciated.
http://Apex.Oracle.com/pls/OTN/f?p=54577:1
workspace: stone
username:[email protected]
password: apex_demo
Thank you
SuryaHi Surya,
I replaced x (node) .innerText = pValue; by $s (textNode, pValue); and it seems to work.
Kind regards
Jonathan -
How to display Quick values in the story
With the help of 11.1.1.6.2
In a dashboard page, I have a table with a hierarchy of dimension for the organization. If you click on a division he runs a link action to call a script in the browser (javascript in a text on the dashboard section) from the division. If you expand the section, and then click on a market, it calls the function javascript even.
Then, the Javascript function uses path go to update an analysis in an iFrame on the dashboard page and passes the value of the Division or the market value.
The analysis of the target has two filters: Division is invited and the market is invited.
So, after all, my question is how could display two values from the call of the road go into a narrative on the analysis of the target? Or I guess the other question is how to view the filter on the narrative values.
Sorry for the long explanation, but I hope it makes sense.
Thanks for any help or suggestion.
BradTry something using the Div tag
for ex:
< div id = filterValues > @{WeekBetween} {Default Value} < / div >
< script >
var i = document.getElementById('filterValues').innerHTML;
document.getElementById('filterValues').innerHTML = aParams ["varDivision"];
< /script >If brand pls help
-
The size of the estimated value of the project is larger than the chosen target support
I am at a loss for trying to create a project using Adobe Encore. I tried initially to the author of the project using the CS2 version. When you try to export, I received the following message is displayed:
"The size of the estimated value of the project is larger than the chosen target support. While it is an estimate, the project may not build. »
I have created hundreds of projects in the past, but have never received this message before. I first thought that the problem was with the release of still I used, but I got the exact error that even trying to create the project with Encore CS5.
The project itself has a menu, a motion menu, and a single video file. The video file 152 last minute, and I was trying to export that to a double layer DVD. I tried from the file using CS5.5 Adobe Premier export using a variety of parameters. I'm trying to export it to a file DVD-2, with the attributes of soure game being the highest value. The parameter on the main concept MPEG encoder is set to 5. I tried to export the file by using the constant and variable bitrates.
When I recently exported the file using a contant 6.5 sampling rate, I still 650,4 Mo still remaining on my project. I still received the same error message on the size of the project, and so I think that something is wrong.
I even exported the video file into an AVI file compressed and then tried to coding again using CS5.5 Adobe Premier and Adobe encoder. I always get the same error message on the size of the file.
Any help or suggestions on how to solve this problem would be greatly appreciated. Thank you!
If you do not finish with wasted discs...
Create an ISO (yet), or a folder on your hard drive (still or Premiere Elements), then use the FREE http://www.imgburn.com/index.php?act=download to write files or folders or ISO on DVD or BluRay drive (send the author a PayPal donation if you like his program)
.
ImgBurn will read the mark of REAL from the disk drive, which isn't always the same as the label for the box (Memorex is known for 'nothing' buy and put inside a box of Memorex)
.
When you write on the disk with Imgburn, use speed SLOWEST possible setting, so your burner has the best chance to create "good, well trained" laser drill holes... Since no DVD drive is required to read a burned disc, have a 'good' after a try to white high quality will help
.
Use Taiyo Yuden simple layer or layer two Verbatim
Or Falcon Pro for inkjet printable two layer
-
is there a way to display the value of the "number of days to the stadium' in communication?
given that 'number of days at the stage' appears in the historic area and analytics, can we get the value to display in the review section?
We have an oppo report which comes from the reports section because we need current data, but we also need to display the "number of days at the stage", which is only seen in the analytical section.Hello Janet,.
It is rather lengthy to explain. I recommend you to get the book "CRM on demand report - Michael D.Lairson" it's a great book covering analytics in every detail.
In the meantime, here's an excerpt from the book:
Page (400)
The combination of reports in a single report
There are many common situations where you may find that you need a combined analysis.
Some of them do not have access to all the columns of data in a single domain, with data
missing lines due to a natural inner join which causes the report to abandon the lines where it not associated
value exists in another table, or having several columns of the same type that you want to
display in a single column.To create a combined analysis, first create a new report, based on the most appropriate subject
area, add all the columns you want displayed in your report. It's a good idea to move forward
and define the order of the columns now, because it's a bit more complicated to do so after the combination
the report with another report.In step 1 of the window of generation and analysis, expand the section advanced down
of the window. Click the combine with similar analysis button to open a list of all subjects
(see Figure 15-3). You can select a different domain or the same field, you are already
in collaboration with. Click the topic of your choice.The window that appears, shown in Figure 15-4, includes a few new items. Set operations
section now contains three links: the link to columns of results and criteria for your original links
report columns and the columns of your newly added report. The columns of the article shows the
columns of the report based on the link selected in the operations section.The results columns are columns that will appear in the final report of the combination
the criteria columns. You will notice that when you have selected the columns of results across
Operations, each specified column section in the columns section has the properties of the columns, change
Form and Order By buttons that you're used to seeing in your columns of the report. The
formulas in columns of results are empty, however.Click on the first link of criteria, and you will see the columns that you added to your report.
Notice that each column contains now that the button change the formula. The columns that will beRead Page (401) in the rooms - courtesy of Google Book Search. All of this is taken from the book, but should give you enough information to get what you are looking for.
http://books.google.co.uk/books?id=OnbYrkWa4RsC&pg=PA404&lpg=PA404&dq=CRM+On+Demand+-UnionReport&source=bl&ots=qxxnaCWoqV&sig=3P23kMIl-4IIz324jQwZZ6oHb6U&hl=en&ei=qlBtTJ-3GNO4jAe7-fj7CA&sa=X&oi=book_result&ct=result&resnum=1&ved=0CB4Q6AEwAA#v=onepage&q=CRM%20On%20Demand%20-%20Union%20Report&f=false
-
Display several values on the front using the table
For example, if I enter "10" for number of datapoints, I want to see 10 hexadecimal and binary all values in a column. At present, only 1 value appears and erasing all of the previous values
Thank you!
You do not use a shift register to store the values in the table between the fo the loop iterations For.
It is a fundamental concept of LabVIEW.
I recommend you watch the LabVIEW tutorials online
LabVIEW Introduction course - 3 hours
LabVIEW Introduction course - 6 hours -
How to display multiple values in the Email notification?
Hi all
I have a table in my page column, when I click on apply button changes, Notification email will be sent to the user with updated information.
In the notification email, I've included the text field, date field value, everything works fine and I can get by email with the details.
under select query that returns several value.i need to include these values in the notification e-mail.
Please suggest a solution.select distinct asset.NAME AA FROM ASSET_TBL asset join ENV_ASSET_MAP ENV ON ASSET.ID = ENV.ASSET_ID AND ENV.RESV_ID = :P24_ID
I tried the code below, but did not get any email!
Thank youdeclare l_body_html varchar2(4000); env_list apex_application_global.vc_arr2; i number:= 1; begin For enrow in (select distinct asset.NAME AA FROM ASSET_TBL asset join ENV_ASSET_MAP ENV ON ASSET.ID = ENV.ASSET_ID AND ENV.RESV_ID = :P24_ID) LOOP env_list(i):=enrow.AA ; i := i+1; end loop; return Apex_UTIL.TABLE_TO_STRING(env_list,':'); l_body_html := '<p><font size ="3" color = BLUE> <u> New Reservation Form</u></font> <br><br> <table> <tr><td> Selected Reservation : </td><td>'||env_list(i)||'</td></tr> </table><br><br> </p>'; apex_mail.send( p_to => '[email protected]', p_from =>'[email protected]', P_CC =>'[email protected]', P_BODY => l_body_html, P_BODY_HTML => l_body_html, p_subj => 'Notification Mail!'); wwv_flow_mail.push_queue(); EXCEPTION WHEN OTHERS THEN l_body_html := l_body_html || '. Error Occurred while sending email='||SQLERRM; apex_mail.send( p_to => '[email protected]', p_from => '[email protected]', P_CC => '[email protected]', P_BODY => l_body_html, P_BODY_HTML => l_body_html, p_subj => 'Notification Mail!'); wwv_flow_mail.push_queue(); end;
with respect,
Robette.Your process will end with the return on line 11 statement.
I think that instead of return you want to load a local variable you put int the body of the email. That is to say. See *.
declare l_body_html varchar2(4000); env_list apex_application_global.vc_arr2; i number:= 1; ******l_asset_name_list VARCHAR2(32767);* begin For enrow in (select distinct asset.NAME AA FROM ASSET_TBL asset join ENV_ASSET_MAP ENV ON ASSET.ID = ENV.ASSET_ID AND ENV.RESV_ID = :P24_ID) LOOP env_list(i):=enrow.AA ; i := i+1; end loop; *******l_asset_name_list :=* Apex_UTIL.TABLE_TO_STRING(env_list,':'); l_body_html := '
New Reservation Form
Selected Reservation : '||*******l_asset_name_list*||'
'; apex_mail.send( p_to => '[email protected]', p_from =>'[email protected]', P_CC =>'[email protected]', P_BODY => l_body_html, P_BODY_HTML => l_body_html, p_subj => 'Notification Mail!'); wwv_flow_mail.push_queue(); EXCEPTION WHEN OTHERS THEN l_body_html := l_body_html || '. Error Occurred while sending email='||SQLERRM; apex_mail.send( p_to => '[email protected]', p_from => '[email protected]', P_CC => '[email protected]', P_BODY => l_body_html, P_BODY_HTML => l_body_html, p_subj => 'Notification Mail!'); wwv_flow_mail.push_queue(); end;There may be other things to settle, these seem to be the main problem.
-
display multiple values at the completion point
All,
IAM create multiple entries for autopopulate point as shown in this jquery plugin link below but iam trying to change that, then values from the query to the table. How can I achieve even using web services apex 4.1.1 but iam trying NOT to use remote url or external file?
http://jQueryUI.com/AutoComplete/#multiple
concerning
All,
I'm still digging around and looking everywhere but this blog below how I can pass the valueset returned to my jquery as variable below.
sample:
http://ORA-00001.blogspot.com/2010/02/ref-cursor-to-JSON.html
var availableTags is ['data1', 'data2', 'data3'];.
concerning
-
Matrix of distances: selection of values with the number of the column as a variable
Hi all
You wonder if SQL can do natively, let's go.
I have a static table with the same amount of rows and columns, that changes forever; It represents the distances between locations (e.g. countries).
It's basically a distance matrix (you can find a good example on Wikipedia ).
My SQL statement must extract the distances of this matrix, based on the IDS of countries located in another table.
Select a field is simple:
SELECT * from cdistances where countryid =
(select countryid from countries where upper (country) = upper (& getcountry));
When I run the present, I get a line of all distances to all countries of the country I go when asked. But I would limit the outcome of a country of destination that I entered.
Of course, a CASE statement would solve this nicely, but since we are talking more than 200 countries, which will become unmanageable.
Another method that I approached is to use a variable as a column, as below:
SELECT & getdestination of cdistances where countryid =
(select countryid from countries where upper (country) = upper (& getcountry));
It works well when I get directly the column identifier (manually from the keyboard) but I would like to automate even further.
My names of columns in the matrix of distances are named as follows:
countries1, countries2, countries3... country200 - where the number ID the real country, preceded by the constant string 'country '.
So I tried to define a variable as a concat between 'country' and another variable:
def getd2 = concat ("D2C", & testcountryid);
Of course, it does not; the output of the script is:
old: def getd2 = concat ('country', & testcountryid)
New: def getd2 = concat ("country", 12)
where I expected to be 'country12.
I'm so little loss of thoughts. Maybe I'm pushing my train of thought in the wrong way, so I guess the general question would be: how to select a specific column of a table based on information outside the SQL statement dynamically?Hello
I'm still confused.
Is your table called chessking or testdistances, or you have 2 separate tables?I'm guessing that your single table is testdistances, and you want to pass a list of countryids, such as that of 3.1 to a query and get results as follows:
`COUNTRYID DISTANCE3 DISTANCE1 ---------- ---------- ---------- 1 18 15 3 13 1
If so:
DEFINE country_list = "3,1" -- Preliminary Query, to set column_list COLUMN column_list_col NEW_VALUE column_list SELECT 'distance' || REPLACE ( '&country_list' , ',' , ',distance' ) AS column_list_col FROM dual; -- Main Query SELECT countryid , &column_list FROM testdistances WHERE countryid IN (&country_list) ;
Sorry, I'm out of time now. I'll explain more in a few hours.
-
How to check the decimal value in the number field
Is it possible to find the number of decimal digit is used.
999.444
444.45
344.23
33.666666666666
Query provide rusult after the decimal value.
Thank you.user-Keen wrote:
Query provide rusult after the decimal value.Thank you.
your_col - trunc(your_col)
You have negative numbers?
For negative values that you want to display?
If only the decimal part, you can use ABS (col) - trunc (ABS (col))
Published by: JAC on 4 April 2013 15:29
-
Set initial value as the number of sequence/date/from the user
Hi guys, I created a datablock and set up the user interface to allow users to insert all the data they need, however my table has a:
ID - which is uniqe with each entry of the table is then gernerate by a sequence (that I created on the database), but when I put seq.nextval in the initial value on the datablock it says that I can not do that, so how can I use the sequence to insert the value in this field in the database. It's my first key in my whichobviosuly database my users cannot enter data for, on the contrary, it is generated automatically.
User - in the same way in the datablock is a user field that has the user that inserted record, I know I can set the default for this field, but how to make the user automatically insert through forms on the database.
Same again how put SYSDATE is automatically entered in the field date when the user submits the file?
Any help on this would be GREATLY appreciated.
Thanks in advance.
Published by: user13390506 on August 5, 2010 04:11The DUAL table:
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/queries009.htm#sthref3198With: new, you reference the column should be inserted (in a trigger to update you: old and: where new: old contains the value before and: new value after the update of the column)
Regarding your real problem: without a few pieces of code fails and you did, it's a little difficult to say what happened here. If you could get better answers by sharing.
Sharing also the Versions of database (4 digits) and Versions of forms is important in order to obtain a response apropriate.
Anyway: you seem to be new to the whole forms / SQL / PL/SQL stuff, so I might suggest:
http://Tahiti.Oracle.com is a very good starting point for SQL and PL/SQL. This isn't a RTFM but rather a Council. Once you got used to you will like it. For my part, I could not live without tahiti: D.Cheers.
-
Windows 7 Home PC Toshiba laptop connected to Epson Stylus CX500 and desktop connected to HP Photosmart 3210 browser is Firefox and email is Hotmail.
When you attempt to print from Hotmail reduced the font size to 40%, which is not readable. If the size is more than 40% zoomed, it produces a blank page. Have checked the font size setting a TI is 18. Both printers are the same thing. Also tried open with Internet Explorer and got the same results. Local artists have no answers. Any ideas?Hello
1. what version of Internet Explore do you use?
2. this problem only occurs with this application?
If you use Internet explorer, I suggest you to see the links and check.
I can't print or preview before printing a Web page in Internet Explorer
http://support.Microsoft.com/kb/973479
Preview the appearance of a printed Web page
http://Windows.Microsoft.com/en-us/Windows7/preview-the-appearance-of-a-printed-webpage
You cannot print or print preview Web pages in Internet Explorer on Windows Vista or Windows 7
http://support.Microsoft.com/kb/973479
WARNING: Reset Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings
-
Displays two values in the column with the concatenation of good
I have a query Select col1 | ' >' || col2 from table1.
For example: the table below has the records.
Col1 Col2
Orange color
red color
White color
Yellow color
Result of: existing query
Orange > color
Red > color
White > color
Yellow > color
But I want to display two columns in the order appropriate as the below one.
Veuileez note that all the the first character of the col2 must start the position of sampe in a row.
Orange > > color
Red > > > > color
White > > > color
Yellow > > > colorHello
Knowing the value that should be completed when running...SQL> with tab as 2 (select 'Orange' Col1, 'color' Col2 from dual union all 3 select 'red' , 'color' from dual union all 4 select 'White' , 'color' from dual union all 5 select 'Yellow' , 'color' from dual) 6 Select RPAD(col1,(select max(length(col1)) +1 7 from tab),chr(32))||chr(9) ||col2 data 8 from tab; DATA -------------------------------------------------------------- Orange color red color White color Yellow color
Twinkle
-
to display several values in the column as a simple comma separated
Hello..
My the source table structure is as
test_123
person_id varchar2,
phone_no varchar2
A unique person_id can have several phone_nos
as
person_id phone_no
123 1245
123 1246
123 1247
12460 124
124 12461
Now I want the output voltage
person_id phone_no
123 1245,1246,1247
124 12460,12461
How d she?
I want it in a single query?Many many many examples here.
http://www.Oracle-base.com/articles/Misc/StringAggregationTechniques.php
Maybe you are looking for
-
suddenly, last night something happened with youtube. whenever I run a video on youtube its green for a few seconds, then it goes back to normal. its also green when I fast forward/jump and when I change between full screen and windowed. I linked to
-
System event notification services error
A couple of weeks, I started getting a message at startup in VISTA. The message appears in the lower right. It is said:Unable to connect to a windows service. Windows could not connect to the System Event Notification Services service. This problem p
-
I have a netbook Acer Aspire One AOD257. It's really slow. When I use internet, it warns me sometimes that I am low on memory. I only have 1 GB of ram. I tried everything, antivirus, disabling startup services, uninstall bloatware but still no cigar.
-
Driver IRQL NOT LESS or EQUAL blue screen (d1)
I got a blue screen for a while. I tried the solutions on the page to "Solve the blue screen errors", but they did not work. Here's my DMP files: https://www.mediafire.com/folder/ref1h2243hvxr0y, sqj4vqx760qxpc5/shared Thanks in advance for the answe
-
X 300 modem, battery &; GPS issues
Hi all I have a X 300 and I would like to know a few things: -J' I found the SIM card under the battery... by coincidence. I plugged my SIM (3G - Telstra NextG) and tried to connect to the net, but it is not detected. I used the same SIM in a dongle