Formula to select first record on the column
Hi All
I need a formula to select a first record on the column, here is my query
SELECT DISTINCT
dbo.OWOR.DocNum, dbo.OWOR.ItemCode, dbo.OWOR.Status, dbo.OWOR.PlannedQty, dbo.ITM1.Price, dbo.OWOR.Warehouse,
dbo.OWOR.PlannedQty * dbo.ITM1.Price AS Total
FROM dbo.OWOR INNER JOIN
dbo.ITM1 ON dbo.OWOR.ItemCode = dbo.ITM1.ItemCode
WHERE (dbo.OWOR.Status = 'P') OR
(dbo.OWOR.Status = 'R') AND dbo.ITM1.Price
I need to select the first price on the price list for (dbo.ITM1.Price).
Regards
Bongani
Bongani,
Are you sure you don't want to link a pricelist? Because the unique key on ITM1 consists of ItemCode and PriceList and taking the first price for an item in ITM1 could result in kind of random prices for different items, depending on whice pricelist gets filled first for a certain item.
Similar Messages
-
The detailRegion is always forced to populate the first record from the Master region
Hi fellow Spry enthusiasts,
My question is in regards the undesirable data population of
the regiondetail on initial load. I have 2 sections, one which is
my master region (which goes out and retrieves a bunch of records),
and a related detailregion which reacts based on the master.
However, every time I initiate a query of the master region to
retrieve records, the detail region also responds and automatically
grabs the FIRST record of the master region (which is undesirable
in my case because I do not want the detail region to react UNTIL I
select a record in the master region). Let me know if this makes
sense.
Psuedo Code:
var moveRequestor = new
Spry.Data.XMLDataSet("cfc/QueryThatReturnsABunchOfEmployeeRecords")>
<span spry:region="moveRequestor">
{EM_ID}
{NAME}
<span spry:detailregion="moveRequestor">
{EM_ID}
{NAME}
{PHONE}This question was posted a while ago, and was one of the
search results that came up when I was looking for my own answer. I
had a nearly identical question and answered it here:
Disabling
default linked region and detailregiondisply until click
Hopefully it will help others too! -
Unable to search for first record using the Preview tree
Post Author: TheBig1980s
CA Forum: General
Hello:
Users are unable to search for the first record in the Preview tab's tree. The reason for this is because the first record is within the first page header of the report. My guess is that, by design, Crystal takes the end user to whatever the first instance of the record iseven if that first record is in a page header. That's not "good". I want the user to be taken to the first record within the details of the reportnot within the page header.
I have suppressed the page header to not print on the first record by using OnFirstRecord. But, I still get the same issue where end users cannot select the first record in the tree without being taken to the page header. Very strange.
Can anybody think of any other ideas?
Thanks!
TheBig1980sThank you Dave Merchant and try67 for your responses. As per my previous post, I contacted the company re the catalogue and they have responded favourably. I'll include their response because it gives the reason for the search failure as document compression which you might find interesting. I'll await their new catalogue and see if they have fixed the problem.
Company response:
Thank you very much for your input. And yes, you are correct, the compression we used for the current catalogue's PDF format does strip out text included in the catalogue. We used the compression settings we did with the intention of minimising download time, however I take your point about including text for search purposes (which I also utilise when I'm scanning through PDFs).
We will actually be posting out our new catalogue next week and we'll release the new PDF version on the website at the same time. I've asked our graphic designer to ensure that the PDF we use for the new catalogue includes searchable text. -
File Write Adapter, First record as a Column Header
Hi,
Using File adapter of type WRITE i m creating a file.
I want to include the column header also as a first record in File.
One way i can think of Creating one record manually and append as a first record in the File write variable.
Is there any other simple way or standard way to do it??To have fixed header every time before it writes the data, i think you should have file with header and data, then use it to configure file write in JCA adapter.
This will create a schema with static header and dynamic results to the schema file.
So that everytime you will have the header then it write the data below that.
Note: I have done this some years back, i wrote here with from my memory.
Let me know if you still have problem, wll try to create a simple example and share.
Thanks,
Vijay -
Update a record is updating the first record in the DB...HELP!
I am going over and over this again and cant find the problem.
i have a form that sends email to emails that are on a php mysql db however when i update certain records it always is updating the first record in the DB...i have looked over this so many times and cant see what is going wrong
the userid is not auto_increment but is based on the username (these are all unique)
i have uncluded the code to see if i am missing something
<?php require_once('../Connections/hostprop.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE plus_signup SET email=%s, emailerSubject=%s, emailerContent=%s WHERE userid=%s",
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['emailerSubject'], "text"),
GetSQLValueString($_POST['emailerContent'], "text"),
GetSQLValueString($_POST['userid'], "text"));
mysql_select_db($database_hostprop, $hostprop);
$Result1 = mysql_query($updateSQL, $hostprop) or die(mysql_error());
// Email Guarantor
$to = $_POST['email'];
$subject = "Email From Host Student Property";
$message = "
<html>
<head>
<title>Dear ".GetSQLValueString($_POST['userid'], "text")."</title>
</head>
<body>
<img src=\"http://www.hoststudent.co.uk/beta/images/hostlogo.gif\" alt=\"www.HostStudent.co.uk\" />
<h2>An Email From Host Students</h2>
<br /><br />
<table>
<tr>
<td>Email Subject:</td>
</tr>
<tr>
<td>".GetSQLValueString($_POST['emailerSubject'], "text")."</td>
</tr>
<tr>
<td>Email Content</td>
</tr>
<tr>
<td>".GetSQLValueString($_POST['emailerContent'], "text")."</td>
</tr>
</table>
</body>
</html>
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: HostStudent.co.uk <[email protected]>' . "\r\n";
$send = mail($to,$subject,$message,$headers);
$updateGoTo = "TenantEmailSent.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $updateGoTo));
mysql_select_db($database_hostprop, $hostprop);
$query_Recordset1 = "SELECT userid, email, emailerSubject, emailerContent FROM plus_signup";
$Recordset1 = mysql_query($query_Recordset1, $hostprop) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?
session_start();
if(!$_SESSION['loggedIn']) // If the user IS NOT logged in, forward them back to the login page
header("location:Login.html");
?>
<script type="text/javascript">
function loadFields(Value) {
var Guarantor = Value.split("|");
var userid1 = Guarantor[0] ;
var GuName = Guarantor[1];
var GuPhoneEmail = Guarantor[2] ;
document.getElementById('userid1').value=userid1;
document.getElementById('GuName').value=GuName;
document.getElementById('GuPhoneEmail').value=GuPhoneEmail;
</script>
<form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><select name="userid" id="userid" onchange="loadFields(this.value)">
<option value="Select Guarantor">Select Guarantor</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['userid'] . '|' . $row_Recordset1['GuName'] . '|' . $row_Recordset1['GuPhoneEmail'];?>"><?php echo $row_Recordset1['userid'] . " , " . $row_Recordset1['GuName'] . " , " . $row_Recordset1['GuPhoneEmail']; ?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
?>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Tenant Name</td>
<td><input type="text" name="userid1" id="userid1" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['userid'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">GuName:</td>
<td><input type="text" name="GuName" id="GuName" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['GuName'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">GuPhoneEmail:</td>
<td><input type="text" name="GuPhoneEmail" id="GuPhoneEmail" readonly="readonly" value="<?php echo htmlentities($row_Recordset1['GuPhoneEmail'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">GuEmailerSubject:</td>
<td><input type="text" name="GuEmailerSubject" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">GuEmailerContent:</td>
<td><textarea name="GuEmailerContent" cols="45" rows="5"> </textarea></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Send email" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"></td>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form2" />
<input type="hidden" name="userid" value="<?php echo $row_Recordset1['userid']; ?>" />
</form>i have found the problem, there were two forms with the same name..
thanks -
Oracle Forms returns the first record in the database when performing query
Once in a while when we query for a record on a form, say by first name Tom, then it returns the first record in the database. Other times it return the Tom's record. It only happens once in a while and if you close the form and reopen it and requery for Tom, then it brings Tom's record.
Does anyone know the issue what could be happening. It just happens every now and then that it's hard to reproduce.
ORacle Forms 10GR2
ORacle Application Server 10.1.3
thanksthen it returns the first record in the databaseI'm not sure if i understand you correctly. Do you mean forms ignores the searc-condition you entered? I would check SYSTEM.LAST_QUERY at the moment this happens to check if the condition gets somehow lost.
-
Master-Detail only shows the first record of the Master's data
I have an ADF Master Table, Detail table. I use ExcuteWithParams on the Master Table. When executed from a button (Button has partial submit = true for button, Master Table has PartialTrigger on button, and Detail table has PartialTrigger on Master table and button), it works fine. However, I want to pass the parameters in pageFlowScope variables, and have the ExecuteWithParams invoked upon page load. When I try to do this, the Detail table only shows the first record of the Master's data, no mater what row is clicked on the Master table.
Master table now has no PartialTrigger, and Detail table has PartialTrigger on Master table. In my pageDef, I used an invoke action as follows:
<invokeAction Binds="ExecuteWithParams" id="invokeExecuteWithParams"
Refresh="always"/>
What am I missing? I am using verion 11.1.1.3. Any help would be much appreciated.
Thanks,
JessicaYes, it works when I drag the data control as a master detail without filtering any data. I want the user to be able to set search criteria to filter the data in the master table (For example, only pull back data with a transaction date between :startdate and :enddate). I can get it to work if I execute from an executewithparams button on the page, but not if I want to invoke the executewithparams upon page load with the parameter set by pageflowscope variables.
Thank you for responding.
Jessica -
How can I select random records from one column
How can I random select 400 records from a column contains more than 500,000 records? And how long will it take in oracle? Thanks.
here is one option: (just change 5 to suit your needs...)
SQL>select * from (
2 select object_name
3 from all_objects
4 order by dbms_random.random
5 ) where rownum < 5
6 /
OBJECT_NAME
UTL_SYS_COMPRESS
GV_$LOG_HISTORY
GV_$LOGMNR_LOGS
WWV_FLOW_THEME_7
SQL>/
OBJECT_NAME
WWV_FLOW_UPGRADE_REPORT
WRI$_ADV_SQLT_STATISTICS_PK
V_$DATABASE
GV_$SERVICEMETRIC
SQL>/
OBJECT_NAME
WWV_FLOW_CREATE_FLOW_API
WRH$_SERVICE_WAIT_CLASS_BL
EXU8SNAPL
GV$SERVICEMETRIC_HISTORY
SQL> well, regarding how long will it take... it depends from lots of variables...
Cheers,
Andrea -
How to select multiple records in the ALV POP UP by using oops
Hi All,
We have a requirement of ALV POP UP by using the OOPS. How to select the multiple records in the POP UP and After selecting that i want do Inteactive ALV means again one more POP UP in ALV.
Thanks for help....
Regards,
BharaniHello Bharani
Displaying an ALV list in a popup is by no means different from a list displayed on a main screen. The only thing you need to consider is that you set the right screen level when creating the parent container for the ALV.
For more details refer to thread in CL_GUI_SPLITTER_CONTAINER ALV list is not show in called screen
" step 1:
CREATE OBJECT gr_spliter
EXPORTING
parent = cl_gui_container=>screen0 " For first popup use: =>screen1
rows = 1
columns = 2.
Regards
Uwe -
Formula for getting first letter of the string
Post Author: jmmj
CA Forum: Formula
Hi, I have a problem to get the first letter of the string. I need to compare first letter first and then change the rest of string to number as unit cost for calculation. For example, I have string K100, C200,... if first letter = K then 0 else if first letter = C then tonumber200..... I use CRXI, any assistance will be appreciate.jmmjPost Author: jmmj
CA Forum: Formula
It works, thanks Kai!But when I tried to print the report, there are multiple lines shown same invoice number but different unit price. My formular is: IF {OEINPR3.COINTYPE} = 2 OR CCur({OEINPR3.LINETYPE}) = 1 //line type 1 for item, 2 for misc. charge THEN( IF {OEINPR3.COIN}[1] = "K" OR {OEINPR3.COIN}[1] = "N" THEN TONUMBER(MID({OEINPR3.COIN},2,20)) ELSE 0)ELSE 2 //for testing only The result I have: Line# Inv# unitprice total1 IN001 0.00 10.00 IN001 10.00 10.00 2 IN002 0.00 20.00 IN002 20.00 20.00.......The second line of each invoice is correct. How can I print just one line for each invoice which is correct? Thanks!jmmj -
Query to select all records in the database
Hi,
i am in big trouble please help me...
unfortunately i did some modifications in live system due that system was stopped...
now i want to know what are all changes i have done in the database....
please give me the query to see all the records in the specified schema....
not for one table. i cont specify the table names also..
MY Question is for example if i want to search updated_by field in one table i will do like this
select * from eiis_salesorder_hdr where updated_by = 'is20';
like that only i want query to search in entire schema....
Edited by: indra on Sep 17, 2011 8:58 AMindra wrote:
Hi,
i am in big trouble please help me...
unfortunately i did some modifications in live system due that system was stopped...
now i want to know what are all changes i have done in the database....
please give me the query to see all the records in the specified schema....
not for one table. i cont specify the table names also..if DML was done & no COMMIT was issued, then changes would be rolled back after system restart
what EXACTLY was issued SQL?
do as below so we can know complete Oracle version & OS name.
Post via COPY & PASTE complete results of
SELECT * from v$version; -
Selecting multiple records from the list and append it into internal table.
hi
there is a list of 10 records in the output screen with check boxes. if the user select any 3 records then those records should get appended in some other internal table of same structure.
this is the requirement. can anybody help me it is very urgent.
regards
samiHi,
Loop at the internal table which contains the value in table control and move it to a work area. apend the work area to the next internal table. Like:
loop at it1 into wa1 where sel = 'X'.
append wa1 to it2.
endloop.
or
loop at it1 into wa1.
if wa1-sel = 'X'.
append wa1 to it2.
endif.
endloop.
Regards,
RM -
Select one record for the first matching condition only in four where condi
I need your suggestion to write one tricky SQL query to select only one record from database on the following condition.I explained simple table structure below.I have a table temp with four columns a,b,c,d in it.
I have to select column d from this temp table based on the following four conditions.If it matches any condition, It should skip other conditions, that's the tricky thing.
Conditions order is like shown below.
1) a='argument1' and b='argument2' and c='argument3'(If it matches this condition, it should stop selecting below 3 conditions)
2) a='argument1' and b='argument2' and c='none'(If it matches this condition, it should stop selecting below 2 conditions)
3) a='argument1' and b='none' and c='argument3'(If it matches this condition, it should stop selecting below condition)
4) a='argument1' and b='none' and c='none'(this is last condition)
If I use OR operator , it matches all of those other conditions too.I never wrote query like this before.
I greatly appreciate if somebody sheds light on me to start writing this query with a simple suggestion.
Thanks,
GDThis forum might help you out, as they are experienced SQL developers, however, this forum is primarily for queries about the tool, SQL Developer. I recommend you post this on the SQL & PL/SQL forum where they focus on these queries:
PL/SQL
Sue -
Selecting FIRST record w/o fetching them all
Hi:
Is there a way to select any one record from a set or potentially many without having to actually fetch them all?
For example, I want to get the last name of only one person with the first name 'joe' from the employees table. I don't care which "joe" it finds. I don't want Oracle to go through the expense of fetching them all before arbitrarily givnig me one of them.
select last_name from employees where first_name = 'joe' and rownum = 1;
...works, but I suspect that Oracle's getting all "joe"s before giving me the one where rownum=1.
I suppose I could do this with a cursor... open... fetch... close (only do 1 fetch), but is there a more elegant way?
Thanks in Advance!I dunno about that.
I ran a query fetching a single record from a table which has close to 5 million records. I limited with "and rownum = 1". It took a long time, but eventually returned a valid answer.
I ran looking at the query plan, with and without the "rownum = 1". This is what I found...
SQL> explain plan set statement_id = 'foo' for select name from imp_insts where rownum = 1;
Explained.
SQL> select lpad(' ',2*LEVEL)||operation||' '||options||' '||object_name qplan
from plan_table
where statement_id='foo'
connect by prior id=parent_id and statement_id='foo'
start with id=1; 2 3 4 5
QPLAN
COUNT
FILTER
TABLE ACCESS FULL IMP_INSTS
SQL> delete from plan_table;
4 rows deleted.
SQL> explain plan set statement_id = 'foo' for select name from imp_insts;
Explained.
SQL>
select lpad(' ',2*LEVEL)||operation||' '||options||' '||object_name qplan
from plan_table
where statement_id='foo'
connect by prior id=parent_id and statement_id='foo'
start with id=1;SQL> 2 3 4 5
QPLAN
TABLE ACCESS FULL IMP_INSTS
SQL> select count(*) from imp_insts;
COUNT(*)
4936477
I see the "FILTER" but no "STOPKEY". I didn't trust the query that I used to show the execution plan, so I spooled "select * from plan_table" to a file and grep'd for both "STOP" and "KEY". No mention of STOPKEY.
Oracle8i on Tru64. -
BI omits first characters of the column
Getting realy strange situation with quering data from database - starting from the second row BI omits first n characters, where n is number of current row minus one. For instanse:
Column in the database stores
POS-терминал
iBox
N/A
Мобильное приложение
АТМ
Терминал самообслуживания
Отделение
When we try to view data in Administration Tool it shows folowing for this column
POS-терминал
Box
ильное приложение
нал самообслуживания
ние
Analytics in the web shows the same.
BI version is *11.1.1.6.2 (Build 120605.2000 BP1 32-bit)* installed on Linux 5 (it's actualy prebuild virtual demo downloaded from OTN)
The database is Teradata 13.10, using ODBC driver of the same version. Characterset is UTF8, odbc is set to ANSI mode.
The issue is only for cyrillics letters, when quering english characters evrything is ok.
Edited by: 898973 on 31/1/2013 4:12SQL> INSERT INTO dt_test VALUES('ABL - Allied Corp. services (XES) - Newyork');
1 row created.
SQL> INSERT INTO dt_test VALUES('ABL - Allied Corp. services (XES) - Chicago');
1 row created.
SQL> INSERT INTO dt_test VALUES('SBS - Logistics - Newyork');
1 row created.
SQL>
SQL> select
2 column_1
3 FROM
4 dt_test
5 ORDER BY
6 SUBSTR(column_1, INSTR(column_1,'-',1,2) + 2);
COLUMN_1
ABL - Allied Corp. services (XES) - Chicago
ABL - Allied Corp. services (XES) - Newyork
SBS - Logistics - Newyork
Maybe you are looking for
-
Way to extract files from TM Backup from another Mac?
Earlier this week my 2mo old work iMac's HDD got corrupted. I took the iMac into an Apple store and they decided it needed a new hard drive. Luckily, I use Time Machine on a constant basis so I have a backup of all my work files. However, while the i
-
Query needed for sorting by time value
Hi Folks We have table it consists two columns like below Job_name varchar2(50) Scheduled_time date The filed scheduled time keep date and time value like below 25-Jul-2009 4:00:10 AM 26-Jul-2009 4:00:01 PM 27-Jul-2009 4:00:00 PM 28-Jul-2009 4:05:00
-
0QUANTITY - Six decimal places - Rouding to the third decimal place
Hello experts, how are you? We are facing a problem with decimal places here in the project. We're using M3 unit of measure and the user required 6 decimal places. We already changed ANDEC and DECAN fields from T006 table to value 6, the key figure i
-
Gurus, Ours is a repetitive manufacturing, and for this we need to stage the materials against a planned order using Transaction code = MF60. Please help me quick in the necessary config settings as how to stage the material, through selection of Slo
-
Reading Web Dynpro IView properties
Hi gurus, I'm facing a problem during my Web Dynpro Java development: I created a WD application and deployed it in portal and then I created a Web Dynpro Iview to show my application in portal. Now I want to read the value of one of the properties t