Compare column to another column with a specific value?
What i need to do is compare a column that holds the SiteNames of holidays to another column with the DifficultyDescription of holidays.
I want to show that sites that are not included in boldANY*bold* holiday with an “easy” or “moderate” rating.
Some of my SiteNames have holidays with different difficulty ratings....
e.g Yellowstone National Park(SiteName) - H2 - Moderate(DifficultyDescrip)
Yellowstone National Park(SiteName - H3 - Strenuous(DifficultyDescrip)
In this example i would want Yellowstone not to be in the results of my query as one of its results is 'moderate'.
I want to show holidays that are not in boldANY*bold* holiday with 'easy' or 'moderate'
Here is my attempt so far...
select it220_holdet.holcode.holcode as holcode
it220_holdet.diffdetails.diffdescrip as diffdescrip
it220_sitedetails.sitename as sitename
from it220_holidaydetails it220_holidaydetails,
etc....
where it220_sitedetails.sitename != it220_diffdetails.diffdescrip = 'Easy' <<<< where the sitename is not equal to a difficulty description of 'Easy'
and it220_sitedetails.sitename != it220_diffdetails.diffdescrip = 'Moderate' <<<< where the sitename is not equal to a difficulty description of 'Moderate'
Is the logic of this correct? The error message i am getting is SQL command not properly ended.
Is this more of a syntax problem than logic. Any help would be great.
Thanks in advance!
Edited by: Jay on 19-Nov-2010 02:47
Edited by: Jay on 19-Nov-2010 02:47
Hi,
Ok,
Problem is in this part of query
where "IT220_HOLIDAYDETAILS"."DIFFRATING"="IT220_DIFFDETAILS"."DIFFCODE"
and "IT220_HOLIDAYDETAILS"."HOLCODE"="IT220_LOOKUP_SITEHOLIDAY"."HOLCODE"
and "IT220_LOOKUP_SITEHOLIDAY"."SITECODE"="IT220_SITEDETAILS"."SITECODE"
and "IT220_SITEDETAILS"."SITENAME" = "IT220_DIFFDETAILS"."DIFFDESCRIP"
and "IT220_SITEDETAILS"."SITENAME" = "IT220_DIFFDETAILS"."DIFFDESCRIP"
Check are you joining correct columns.
And remove possibility that tables values are in different cases
SELECT "IT220_HOLIDAYDETAILS"."HOLCODE" AS "HOLCODE",
"IT220_HOLIDAYDETAILS"."COUNTRYVIS" AS "COUNTRYVIS",
"IT220_DIFFDETAILS"."DIFFDESCRIP" AS "DIFFDESCRIP",
"IT220_SITEDETAILS"."SITENAME" AS "SITENAME"
FROM "IT220_SITEDETAILS" "IT220_SITEDETAILS",
"IT220_LOOKUP_SITEHOLIDAY" "IT220_LOOKUP_SITEHOLIDAY",
"IT220_DIFFDETAILS" "IT220_DIFFDETAILS",
"IT220_HOLIDAYDETAILS" "IT220_HOLIDAYDETAILS"
WHERE UPPER("IT220_HOLIDAYDETAILS"."DIFFRATING") = UPPER("IT220_DIFFDETAILS"."DIFFCODE")
AND UPPER("IT220_HOLIDAYDETAILS"."HOLCODE") = UPPER("IT220_LOOKUP_SITEHOLIDAY"."HOLCODE")
AND UPPER("IT220_LOOKUP_SITEHOLIDAY"."SITECODE") = UPPER("IT220_SITEDETAILS"."SITECODE")
AND UPPER("IT220_SITEDETAILS"."SITENAME") = UPPER("IT220_DIFFDETAILS"."DIFFDESCRIP")
AND UPPER("IT220_DIFFDETAILS"."DIFFDESCRIP") NOT IN('EASY','MODERATE')Regards,
Jari
Similar Messages
-
Copy from column to another column in same table
Hi,
Working on EBS Version : 11.5.10.2
Table Name : ASO_QUOTE_HEADERS_ALL
COLUMNS :
QUOTE_STATUS_ID NUMBER
ATTRIBUTE6 VARCHAR2(240 BYTE);
Need to copy from quote_status_id to attribute6 for that quote_header_id
example if quote_status_id = 10 then it should copy in attribute6 = 10 for quote_header_id = 69312
again if changed to quote_status_id = 10077 then it should replace with attribute6 = 10077
for quote_header_id = 69312
i wrote a procedure posted below:
CREATE OR REPLACE procedure SLC_STATUS_CAPTURE (p_quote_header_id IN number) is
BEGIN
UPDATE aso_quote_headers_all SET attribute6 = quote_status_id
WHERE quote_header_id = p_quote_header_id;
end SLC_STATUS_CAPTURE;
then calling this trigger through table level
BEGIN
SLC_STATUS_CAPTURE(:OLD.QUOTE_HEADER_ID);
END;
it is giving an error.
Please i need some help.
Thanks and Regards
VijayJohn Spencer wrote:
As others have mentioned, you cannot change column values in a statement level trigger. Also, you cannot
update the table that the trigger is firing on. If I understand correctly, you want to copy the value of
quote_status_id into attribute6 whenever a row is inserted or updated. If that is correct, then you only need a simple trigger like:
create trigger trigg
before insert or update of aso_quote_headers_all
for each row
begin
:new.attribute6 = :new.quote_status_id;
end;Thought why anybody would want to do this is beyond me - you already have the info
in your attribute6 column - what's the point in simply copying it to another column in
the same table?
Paul...
John -
SQL update one column from another column
I'm looking for a way to update a SQL column with a portion
of info from another column in the same table.
example of a sql command
UPDATE table1
SET table1.columnname1 = table1.columnname2
FROM table
WHERE blah blah blah
Here's the thing... I only need a portion of the data found
in the source column. I'm not sure how I would do this then.
for example, the database has countries and states combined
into one column like this 'US-DC', 'US-CA', US-FL', etc. I want to
separate these into two columns, a country column and a state
column.... and I dont want to go though all the results and do this
line by line. How would I write the SQL command so that it puts
just the country in the country column, and puts just the state in
the state column, and it omits the dash all together.
any ideas?It depends. Are you using PHP and mySQL or ASP and SQL?
If you are using mysql and PHP you could use the following
code to loop through all records in your datatbase.
$sql="SELECT * FROM tablename"; //SET tablename to the name
of your database table.
$result=mysql_query($sql)or die(mysql_error(). " - $sql");
for($x = 0; $row=mysql_fetch_assoc($result); $x++){
//set up the variables from the table
$ID=$row['ID']; //this is the primary key
$var1=$row['contrystatecolumn']; //this is the name of the
column which holds the country-state
$var2=explode("-", $var1); //now we explode the string to get
the country and the state seperated and place the results into an
array
$country=$var2[0]; //this is the first piece of the exploded
string in the array
$state=$var2[1]; //this is the second piece of the exploded
string in the array
//now we update the database record with the new information
//remember to replace the tablename with your actual table
name and the columns country and state with the acutal names of
your columns in your table
$sql2="UPDATE tablename SET country='$country'.
state='$state' WHERE ID='$ID'";
$result2=mysql_query($sql2)or die(mysql_error() . " -
$sql2");
This code will loop through every record in your table and do
what you want very quickly.
Hope this helps
Stan Forrest
Senior Web Developer
ATG Internet -
How to place one column under another column in obiee report?
Hi all,
I am new to obiee, so need some help from obiee experts. Can anyone tell me how to place one column data under another column in obiee report?
i need the report to be as below
category total_students Course_enrollment Test_attended pass_test
total N % N % N %
all students ##### ## ## ## ## ## ##
Ethnicity
Asian ###### ## ## ## ## ## ##
African American ###### ## ## ## ## ## ##
white ######
Filipino ######
Gender
Male ##### ## ## ## ## ## ##
Female ##### ## ## ## ## ## ##
and similarly for other columns
where ethnicity, gender are columns in the table and Course_enrollment, Test_attended, pass_test are calculated columns.
Please help me to create a report as above if anyone knows how to do it.
Edited by: Shailaja on Jul 19, 2010 12:23 AMTwo ideas I can think of:
1) Create multiple pivot tables and then display them one under the other
2) Create multiple measure columns such as "male_amt", "female_amt", "white_amt", "asian_amt", "black_amt", etc. for all the columns you need. Then you could simple stack them in a single pivot table.
Option #2 might give you the prettiest results - but also requires a lot more maintenance (for instance, if you reclassify ethnic groups, you'd have to go through the reports to add additional metric columns).
Hope this helps,
Scott -
Need Help in Next value of column to another column
Hi,
I am creating view in oracle 10g in which i have 1 custom column who's value are the next value of the another column.
E.g.
C 1 -----C2 ------ custom-C3
10 -------1 --------------2
10 ------ 2 ------------- 3
10 -------3 ------------- 3
11 -------1 ------------- 2
Now is there any function in oracle which gives me to generate "custom-c3"
which gives the data for next value of column 2
Thanks.Hi Frank,
Thank you so much......its working fine in 10 g.....
but for the last row of its coming emply or null but i want value of c2 if its last value.
e.g
C 1 -----C2 ------ custom-C3
10 -------1 --------------2
10 ------ 2 ------------- 3
10 -------3 ------------- 3
11 -------1 ------------- 2
In the above the value of c1 is 10 i.e last one then value of c3 should be value of c2 i.e. 3.
Can you use IF function?
Thanks.
Message was edited by:
user650690 -
Copy the data from one column to another column using @
I have two columns here - A and B.
Column A has a complicated formula that will generate results. I wanted the results in Column A to be reflected in Column B without pasting the A's formula in B. This will save me the trouble of editing formulas in more than 1 column if there is a need.
I saw somewhere that you can use "@" in column B but I have no idea how to use it.
Assumingly column A is the first column. I tried to insert '@1' in B's formula and change B's column properties' Data Format as "Treat Text as HTML". It does not work.
Please advise how I can do that.So is there any way to copy the data in Column A into Column B without putting the same formula? something like in Excel where we put "=C1". Its not possible in BI as it comes in excel.....The only way is to create a duplicate column in RPD or Answers screen and incorporate the formula and giving different name to it.
whats the problem if you duplicate the column with same formula?....Ok still if you dont want to see identical just write some pseudo logic say
Duplicated column f(x) case when 1=0 then column_name else formula end.....so it appears different to see but it outputs same.
UPDATED POST
Dont create in RPD,you can create a dummy column in that report request and change the f(x) to the above case i mentioned by taking the column from columns button in edit formula screen so when ever you edit the actual column formula that would reflect in the dummy column also as it is replicating from original one.Try and see
hope helps you.
Cheers,
KK
Edited by: Kranthi.K on Jun 2, 2011 1:26 AM -
Max of one column in another column
HI all
I have a scenario in the WebI report where I need to get the Maximum value from one column and use that maximum value in calculation of another column for each row in that column.
for ex:
column A
1
2
3
4
5
Max of column A [MAX]= 5
Column B
1/ [MAX]
2/[MAX]
3/[MAX]
4/[MAX]
5/[MAX]
Column B calculation is some thing like described above.
but my issue is, in WebI values are caluclated row wise and while generating values for the first row in column B, it picks the value 1 but the MAX value is not yet caluclated and if I use Max variable it is caluculating as 1/1 for first row and 2/2 and 3/3. Instead of 1/5, 2/5, 3/5.
Any idea please share it.
Thanks
Edited by: saathiyaa on Feb 19, 2011 1:23 AMNo its not working, well actually columb B is nothing but individual value of that row divided by max of that row
for ex:
1/5
2/5
3/5
4/5
5/5
But if i have formula like COLA/MAX[A]
it is cosidering as 1/1, 2/2, 3/3, 4/4.5/5
becuase webi caluclates row wise, so when it is in first row you will see maximum of that column is not yet calculated so it is taking as 1/1 not 1/5. -
Override web.xml With Server Specific Values
Not sure if here or the OC4J/J2EE forum is most appropriate place for this question:
We're currently working on migrating from the old jserv setup to 9.0.4 app server with OC4J. We have the infrastructure installed and are managing the application through Enterprise Manager. In my web.xml file I provide initialization parameters to one of my servlets using something similar to the following:
<servlet>
<servlet-name>util.GlobalPropertyManager</servlet-name>
<servlet-class>util.GlobalPropertyManager</servlet-class>
<init-param>
<param-name>mhris.batch.outputdir</param-name>
<param-value>d:/dev/java/mhris/defaultroot/batch/</param-value>
</init-param>
</servlet>
Now, this directory path I've provided is only good on my local workstation. When I deploy to my UNIX production servers, I need to override this with a valid path depending on the server being deployed to (no, they don't all have the same directory setup, yeah it's a pain). These servers include our production boxes, development server, test, training, etc.
Currently under JSERV, I provide server specific values in the Global Init Parameters section of my property file (don't remember why we didn't use the Servlet Init Parameters property instead). This works very well since this file is not touched when we land updates, so the values are set once for each server.
Under OC4J, I understand that I can override the values in web.xml by using an orion-web.xml file BUT it appears that this file resides in the WAR I deploy, so each server will get the same orion-web.xml rather than maintaining its own set of values.
Is there another .xml file I can use to provide these initalization parameters? global-web-applications.xml looked promising but I wasn't completely sure I could put values for my application in it or where exactly they should go (ie. inside the existing <web-app> section or if I should create a second one specifically for my app).
Any ideas or will I have to reploy a different orion-web.xml file to each of my servers?
Appreciate the assistance,
MichaelMichael,
First, I would just modify the web.xml during each deployment.
Second, I would recommend using the same relative path with the web-app context. Then, you can use the Servlet API to retrive the real path of the web-app context.
I don't think it is necessary to use orion-web.xml or other properties files. -
Select column by comparing data from another column
I have a table of products by their price.
Product
Price
bag
1000
gloves
200
socks
400
hat
100
need to select all products where price is greater than price of "gloves"...
Dhananjay ReleSelect * from Table1
where Price > (Select Max(price) from Table1
where Product = 'gloves');
Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com -
Sql join on two tables where column like another column
hi all,
been trying to get the results from a join between two tables where one column is like another one.
table1 (nameA) examples: black2, green1
table2 (nameB) example: black2.location.uk.com, green1.location.uk.com
so for example I want to match all those in table1 with black2 to the column in table2 that begins with black2 and so on if you see what im trying to get at!
my sql so far:
select * from schema.table1 a
join schema.table2 b
on a.nameA like concat('%', b.nameB, '%'); but it errors:
ORA-00909: invalid number of arguments
00909. 00000 - "invalid number of arguments"
Any help or advice would be greatly appreciated, thankyou!Either of these should do it...
select * from schema.table1 a
join schema.table2 b on a.nameA like '%'||b.nameB||'%';or
select * from schema.table1 a
join schema.table2 b on instr(b.nameB,a.nameA) > 0 -
Printing the totals of 1 column under another column
Hi all,
I have an internal table with 3 fields A, B, C .
I want to print the subtotal of the column 'C' under the column 'A'.
eg:
Material_Group Matnr Cost
MG1 M1 C1
MG1 M2 C2
(C1 + C2)
(This should come under the column "Material_Group" instead of the column "Cost" )
Hope that the requirement is clear. Please help me out in this ..
Thanking you in advance,
Shankara Narayanan T.VHi,
Please use the 'At New' command to get the new material group. take the sum in a variable and use the write statement as shown below.
Write:/ sum under 'Material_group'
Thanks,
Ajith V -
Access datagrid column from another column
Hello
Basically, I have 2 columns in a DataGrid, both with CheckBox itemRenderers.
When I check the first checkbox, I want the second to be enabled = false. I'm stuck.
Thanks!This answers your question:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
import mx.collections.ArrayCollection;
[Bindable] private var ac:ArrayCollection = new ArrayCollection([
{oneSelected: false, twoSelected: false, twoEnabled: true},
{oneSelected: false, twoSelected: false, twoEnabled: true},
{oneSelected: false, twoSelected: false, twoEnabled: true},
{oneSelected: false, twoSelected: false, twoEnabled: true}
public function changeEnabled(evt:ListEvent):void{
var origData:Object = ac.getItemAt(evt.rowIndex);
origData.twoEnabled = origData.twoEnabled == false?true:false;
ac.setItemAt(origData, evt.rowIndex);
]]>
</mx:Script>
<mx:DataGrid dataProvider="{ac}" itemClick="changeEnabled(event)">
<mx:columns>
<mx:DataGridColumn dataField="oneSelected">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selectedField="oneSelected"
change="onChange(event);" label="">
<mx:Script>
<![CDATA[
private function onChange(evt:Event):void {
data.oneSelected = !data.oneSelected;
]]>
</mx:Script>
</mx:CheckBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="twoSelected">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selectedField="twoSelected"
change="onChange(event);" label="" enabled="{data.twoEnabled}">
<mx:Script>
<![CDATA[
private function onChange(evt:Event):void {
data.twoSelected = !data.twoSelected;
]]>
</mx:Script>
</mx:CheckBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Application>
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
www.ChikaraDev.com
Flex / AIR Development, Training, and Support Services -
Plotting Time Stamp from Txt file in Column to another column
I want to know how to plot 2 columns that i am reading from a text file.
column 1 has a time stamp in HH:MMS, and column 5 has data in which i want to plot the time verus the data.The Scan from String function will do most of those conversions in a single step. Here are a couple of examples. You will still need to read the array of strings in and process in a loop.
Message Edited by DFGray on 03-19-2010 07:46 AM
This account is no longer active. Contact ShadesOfGray for current posts and information. -
Display first column and all other with contain first value
Hi,
I have to query table and display resulat in such way:
status_id value1
value2
value3
status_id2 value11
value13
value18
and so on.. Could anyone help me how to do this?Check
SQL> select job, ename from (
select case when row_number() over (partition by job order by job) =1 then job end job,
count(*) over (partition by job) cnt ,
dense_rank () over (order by job) dr,
ename
from emp)
where cnt > 1 order by dr
JOB ENAME
ANALYST SCOTT
FORD
CLERK MILLER
JAMES
SMITH
ADAMS
MANAGER BLAKE
CLARK
JONES
SALESMAN TURNER
WARD
MARTIN
ALLEN
13 rows selected.Note that the one-row entry for KING (PRESIDENT) is missing. -
How to count ONLY fields with a specific value
I modified the code below from the API reference to count combobox fields with a value of "MT" so I could total the number of a specific choice the form user input.
var count = 0;
for (var i=0; i<this.numFields; i++)
var fname = this.getNthFieldName(i);
if ( this.getField(fname).type == "combobox" && this.getField(fname).value == "MT" ) count++;
this.getField("mTurb").value = count.value;
Here's the problem: I tried to use a similar script, modified only slightly from this form, in another total field to tally a different choice made with comboboxes and the script continues to tally the first choice. An example of one of the modified versions of the script is below.
var gcount = 0;
for (var i=0; i<this.numFields; i++)
var gname = this.getNthFieldName(i);
if ( this.getField(gname).type == "combobox" && this.getField(gname).value == "MT" ) gcount++;
this.getField("gPack").value = gcount.value;
I suspect I'm just missing something painfully obvious to seasoned scripters, but I can't seem to figure it out and I need this script to be able to count the number of 9 different options in the comboboxes.OK, you can use a script like the following as the custom calculate script for the text fields that perform the counts:
// Custom calculate script for text field
(function () {
// Declare and initialize variables
var fn, s = "MT", count = 0;
// Loop through the combo boxes
for (var i = 1; i < 25; i++) {
// Determine the current field name
fn = "M" + util.printf("%02d", i));
// See if the field value matches
if (getField(fn).valueAsString === s) count++
// Set this field value to the count
event.value = count;
Change the value of the "s" variable to match the item that you want to count. The first and last lines prevent the unnecessary creatio of global variables, which is good. It also makes it easy to transfer to a more general document-level routine, which would be event better, something like:
// Custom calculate script for text field
function getCBCount(s) {
var fn, count = 0;
// Loop through the combo boxes
for (var i = 1; i < 25; i++) {
// Determine the current field name
fn = "M" + util.printf("%02d", i));
// See if the field value matches
if (getField(fn).valueAsString === s) count++
// Set this field value to the count
event.value = count;
You would then call this function from the individual text boxes with the following custom calculate script:
getCBCount("MT");
and replace "MT" with the vlaue you want to count.
Maybe you are looking for
-
ActiveX Xtra - projector doesn't terminate
Hi all, Has anyone had problems with the projector not terminating correctly when working with the ActiveX Xtra? We are working on a Director application that uses some custom ActiveX controls. When the user quits the projector, the Process for the p
-
How do i put films on my i-pod?
I`ve got an i-phone 5 and an i-pod classic, and i can`t seem to put films on to them, in the past ive been able to put films on my i-pod?
-
Print work from Adobe Photoshop with Elements
can I use Elements to print work created with an old version of Adobe Photoshop (years ago, pre-Elements)
-
Fetch last match data..
table id carno houseno entrytime exit time 1 11 333 3/4/2014 3:15:18 PM 3/4/2014 3:25:18 PM 2 11 333 3/4/2014 3:35:18 PM 3/4/2014 3:45:18 PM 3 11 333 3/4/2014 3:55:18
-
Sorry if this is not the place for this question but was not clear to me where to post it Suddenly, Flash wont connect to CS Live online services. That´s not happening with other products like Dreamweaver and Photoshop. I´m using windows 7 and Firewa