Selecting records from multiple dates but specific time
Hi:
I've to select records of multiple dates but the time should be 00:00:00 to 06:00:00 (i.e. 12 AM - 6 AM)
For date part this can be done:
WHERE
START_TIME BETWEEN TO_DATE('04-01-2012', 'MM-DD-YYYY') AND TO_DATE('04-05-2012', 'MM-DD-YYYY')
But how can I fix the time mentioed above.
Please let me know.
Thanks/Tanvir
WHERE
START_TIME BETWEEN TO_DATE('04-01-2012', 'MM-DD-YYYY') AND TO_DATE('04-05-2012', 'MM-DD-YYYY')
and start_time - trunc(start_time) between 0 and 6/24start_time - trunc(start_time) will give you the fraction of a day. So 6/24 means 06:00.
(When you use to_char(trunc(sysdate,'hh'),'hh24') between 0 and 6 you will also retrieve records with start_time 06:01 for example. So this would not meet your requirements as far as I understood.)
Edited by: hm on 10.04.2012 01:26
Similar Messages
-
Problem selecting records from multiple tables
Good day
I am writing a report showing actual vs budget amount per period. The actual amounts are in one table and the budget amount are in another table. In this example it is for vehicle sales. The problem is that in the budget table, there are no records for a particular make if it was not budgeted to make a sale. If I try to get the records using the select expert it matches the key in actual table with key in budget table and retrieve. What happens then is that the records in the actual table get excluded if there was not a record for it in the budget table. How do I then do this selection, i.e. if there is a record in the budget table, then retrieve, otherwise make the budget amount 0?
Thanks
WilhelmThis is always difficult the best way is to use a command and union the two sets of data.
First part uses a left outer join from Actual to Budget and brings back all actual data with and without a budget.
Second parts brings back data from budegt where nothing exists in actual
select (field list) from
Actual a
left outer join Budget b on a.field = b.field
where (any other filter condition)
union all
select (field list) from
budget b
left outer join actual a on b.field = a.field and a.field is null
where (any other filter condition)
You can get the first query from your current report and the modify to build the second unioned query.
Ian -
Select Records between Begin Date/Time and End Date/Time
Hi, I need to select records from table GLPCA where the CPUDT and CPUTM are between a START DATE/TIME and END DATE/TIME.
I have the below logic from an SAP Solution, but it doesn't seem to be working right in my opinion. It is picking up records earlier than the date ranges. Can anyone tell me how I might be able to accomplish this? I'm hoping this is an easy one for the ABAPPERs...
Thanks,
START DATE 20091022
START TIME 125736
END DATE 20091022
END TIME 135044
CPUDT 20091022
CPUTM 100257
SELECT * FROM GLPCA
WHERE ( CPUDT >= STARTDATE AND ( CPUTM >= STARTTIME OR ( CPUDT <= ENDDATE AND CPUTM <= ENDTIME ) ) ).Thank you all! I ended up using the following:
SELECT * FROM GLPCA
WHERE RYEAR IN L_R_RYEAR
AND ( ( CPUDT = STARTDATE AND CPUTM >= STARTTIME ) OR CPUDT > STARTDATE )
AND ( ( CPUDT = ENDDATE AND CPUTM <= ENDTIME ) OR CPUDT < ENDDATE ).
This child was born from the following thread that was found:
update date and time of client record -
Query regarding the data type for fetcing records from multiple ODS tables
hey guys;
i have a query regarding the data type for fetcing records from multiple ODS tables.
if i have 2 table with a same column name then in the datatype under parent row node i cant add 2 nodes with the same name.
can any one help with some suggestion.Hi Mudit,
One option would be to go as mentioned by Padamja , prefxing the table name to the column name or another would be to use the AS keyoword in your SQL statement.
AS is used to rename the column name when data is being selected from your DB.
So, the query Select ename as empname from emptable will return the data with column name as empname.
Regards,
Bhavesh -
Performance problem with selecting records from BSEG and KONV
Hi,
I am having performance problem while selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
Regards,
PrashantHi,
Some steps to improve performance
SOME STEPS USED TO IMPROVE UR PERFORMANCE:
1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
5. Avoid using nested SELECT statement SELECT within LOOPs.
6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
7. Avoid using SELECT * and Select only the required fields from the table.
8. Avoid nested loops when working with large internal tables.
9. Use assign instead of into in LOOPs for table types with large work areas
10. When in doubt call transaction SE30 and use the examples and check your code
11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
12. Use "CHECK" instead of IF/ENDIF whenever possible.
13. Use "CASE" instead of IF/ENDIF whenever possible.
14. Use "MOVE" with individual variable/field moves instead of "MOVE-
CORRESPONDING" creates more coding but is more effcient. -
Delete records from multiple table
Hi,
I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
Kindly Help.
Thanks,
Alexander.Hi Tim,
Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
Technically, there are other ways of deleting from multiple tables with one statement.
1. "Use a trigger":
What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
2. Dynamic SQL:
Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
3. Using Foreign-Key constraint with Cascade-Delete:
This I feel is a more 'cleaner' way of doing this.
Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind. -
Hi,
I have a method that has to access records from multiple tables and store them all in a file. It's something like this:
switch (tableId){
case 'A' : query="SELECT * FROM TABLE_A
WHERE ID = '" + tempId + "'";
ResultSet rs = stmt.executeQuery (query);
rs.close();
break;
case 'B' : query="SELECT * FROM TABLE_B
WHERE ID = '" + tempId + "'";
rs = stmt.executeQuery (query);
rs.close();
break;
case 'C' : query="SELECT * FROM TABLE_C
WHERE ID = '" + tempId + "'";
rs = stmt.executeQuery (query);
rs.close();
break;
My problem is that I get an "Invalid cursor" error the second time I enter the loop. I've been reading up on cursors but I still don't know what to do. Can I use ResultSet to return multiple rows from multiple tables? If not, what can I use? Please help!
Thanks in advance.remove the "rs.close()" from the switch statement. use "rs.close()" after your loop ends.
prem -
JSF - Problem in Retrieving selected record from datatable
I am new to JSF and in the process of developing a new web application using JSF.
I have problem in retrieving the selected record from a datatable. I am using h:datatable tag and h:commandlink in a column for selecting a particular row on the datatable.
I have populated the data to the datatable by binding a bean and its property.
When I retrieve also I am binding to a bean in the action attribute of the h:commandlink tag in h:column of that datatable.But when I try to bind the bindign attribute of the h:datatable tag to the datatable instance in my Bean , my JSF File gets corrupted..
How to implement this without any issue??plz help me regarding this.HI
Try the below code
DATA lo_nd_del TYPE REF TO if_wd_context_node.
DATA lo_el_del TYPE REF TO if_wd_context_element.
DATA ls_del TYPE wd_this->Element_del.
DATA lo_nd_et_postab_1 TYPE REF TO if_wd_context_node.
DATA lo_el_et_postab_1 TYPE REF TO if_wd_context_element.
DATA ls_et_postab_1 TYPE wd_this->Element_del.
DATA lt_et_postab_1 TYPE wd_this->Elements_del.
DATA: wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
* navigate from <CONTEXT> to <ET_POSTAB_1> via lead selection
lo_nd_et_postab_1 = wd_context->path_get_node( path = `ZSHP_EXTENDED_DUE_LI.CHANGING_3.ET_POSTAB_1` ).
CALL METHOD lo_nd_et_postab_1->get_selected_elements
RECEIVING
set = lt_temp.
* navigate from <CONTEXT> to <DEL> via lead selection
lo_nd_et_postab_1 = wd_context->get_child_node( name = wd_this->wdctx_del ).
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_et_postab_1.
ls_et_postab_1-vbeln = del. // adding new attribute value.
APPEND ls_et_postab_1 TO lt_et_postab_1.
CLEAR ls_et_postab_1.
ENDLOOP.
lo_nd_et_postab_1->bind_table( new_items = lt_et_postab_1 ). -
Download only selected record from ALV
Hi
I want to download only selected records from ALV output with button.
i hav to fix the button on ALV screen using &ZDL whenever user presses the button record should be downloaded.
Pl with coding
its very very urgent.Hi ,
i dont have the exact code which suits to your requirement
but declare the internal table
like
data: begin of itab occurs 0,
check type c,
fields
end of itab.
while filling the field catalog
fieldcatalog-checkbox = 'X'
for this check field.
and display the grid
now write this subroutine
*& Form USER_COMMAND
Called from within the ALV processes. Currently, '&IC1' is used
to process the hotspot and display the document 'picked' by the
user.
PV_UCOMM contains the sy-ucomm from ALV
SELFIELD is a structure that contains all the data required to
process a user selection. The following is an example
of the SELFIELD structure and sample values:
FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
CASE PV_UCOMM.
WHEN '&IC1'.
loop at itab where check = 'X'.
append all these records to another internal table itab1
endloop.
call function gui_download.
pass the internal table itab1 in the tables statement
and also you have to give the file path that may be static or dynamic
if dynamic you have to call the function module
f4_filename
and get the filename and pass the same value to gui_download
that will be download to the above said path
endcase.
end form.
reward points if helpful,
thanks & regards,
venkatesh -
SELECT records larger than date specified in sub query
Dear All
Thank you for your attention.
I would like to select records larger than date specified in sub query
query should be something like the following
SELECT my_order_number, my_date, my_task
FROM MYTB
WHERE my_order_number IN order_no AND my_date > date (SELECT order_no, date FROM MySubQueryResult)
(it is incorrect)
Sub query result:
order_no | date
A1 | 2014-12-21 09:06:00
A2 | 2014-12-20 09:07:00
A3 | 2014-12-20 08:53:00
A4 | 2014-12-20 08:57:00
MYTB:
my_order_number | my_task | my_date
A1 | T1 | 2014-12-21 09:06:00
A1 | T2 | 2014-12-22 10:01:00
A2 | T1 | 2014-12-20 09:07:00
A3 | T2 | 2014-12-20 08:53:00
A3 | T4 | 2014-12-21 09:30:00
A3 | T8 | 2014-12-23 20:32:00
A4 | T6 | 2014-12-20 08:57:00
expected result:
my_order_number | my_task | my_date
A1 | T2 | 2014-12-22 10:01:00
A3 | T4 | 2014-12-21 09:30:00
A3 | T8 | 2014-12-23 20:32:00
Any ideas? Thanks.
swivanHi,
try this
SELECT my_order_number, my_date, my_task
FROM MYTB
WHERE my_order_number IN (SELECT order_no FROM MySubQueryResult)
AND my_date > (SELECT date FROM MySubQueryResult)
Alternatively, you can also make use of joins to achieve the same.
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 |
My Blog | My Page
Dear Praveen Dsa
Thanks for your reply, but order_no and date are paired and related, cannot separate.
each order have its own date, so it is not working
Best Regards
swivan -
Selecting Records from 125 million record table to insert into smaller table
Oracle 11g
I have a large table of 125 million records - t3_universe. This table never gets updated or altered once loaded, but holds data that we receive from a lead company.
I need to select records from this large table that fit certain demographic criteria and insert those into a smaller table - T3_Leads - that will be updated with regard to when the lead is mailed and for other relevant information.
My question is what is the best (fastest) approach to select records from this 125 million record table to insert into the smaller table. I have tried a variety of things - views, materialized views, direct insert into smaller table...I think I am probably missing other approaches.
My current attempt has been to create a View using the query that selects the records as shown below. Then use a second query that inserts into T3_Leads from this View V_Market. This is very slow. Can I just use an Insert Into T3_Leads with this query - it did not seem to work with the WITH clause? My Index on the large table is t3_universe_composite and includes zip_code, address_key, household_key.
CREATE VIEW V_Market as
WITH got_pairs AS
SELECT /*+ INDEX_FFS(t3_universe t3_universe_composite) */ l.zip_code, l.zip_plus_4, l.p1_givenname, l.surname, l.address, l.city, l.state, l.household_key, l.hh_type as l_hh_type, l.address_key, l.narrowband_income, l.p1_ms, l.p1_gender, l.p1_exact_age, l.p1_personkey, e.hh_type as filler_data, 1.p1_seq_no, l.p2_seq_no
, ROW_NUMBER () OVER ( PARTITION BY l.address_key
ORDER BY l.hh_verification_date DESC
) AS r_num
FROM t3_universe e
JOIN t3_universe l ON
l.address_key = e.address_key
AND l.zip_code = e.zip_code
AND l.p1_gender != e.p1_gender
AND l.household_key != e.household_key
AND l.hh_verification_date >= e.hh_verification_date
SELECT *
FROM got_pairs
where l_hh_type !=1 and l_hh_type !=2 and filler_data != 1 and filler_data != 2 and zip_code in (select * from M_mansfield_02048) and p1_exact_age BETWEEN 25 and 70 and narrowband_income >= '8' and r_num = 1
Then
INSERT INTO T3_leads(zip, zip4, firstname, lastname, address, city, state, household_key, hh_type, address_key, income, relationship_status, gender, age, person_key, filler_data, p1_seq_no, p2_seq_no)
select zip_code, zip_plus_4, p1_givenname, surname, address, city, state, household_key, l_hh_type, address_key, narrowband_income, p1_ms, p1_gender, p1_exact_age, p1_personkey, filler_data, p1_seq_no, p2_seq_no
from V_Market;I had no trouble creating the view exactly as you posted it. However, be careful here:
and zip_code in (select * from M_mansfield_02048)
You should name the column explicitly rather than select *. (do you really have separate tables for different zip codes?)
About the performance, it's hard to tell because you haven't posted anything we can use, like explain plans or traces but simply encapsulating your query into a view is not likely to make it any faster.
Depending on the size of the subset of rows you're selecting, the /*+ INDEX hint may be doing your more harm than good. -
Deleting duplicate records from different data packets in BI data source.
Hi,
I am getting same (duplicate) records from different data packets in BI data source, after completion of extraction.
I tried to store key fields of the first data packet in an internal table. But this internal table is not carrying the previous data at the time of extraction of second data packet.
Is there any other way to remove duplicate records after completion of extraction.
Thanks in advance.I did not extensively worked in BI routenes. But I recon there will be routene which will het executed before data mapping part there will be a start routene in which you can validate the existense of data before beeing passed from data source to cube.
Hope this helps,
Regards,
Murthy. -
HELP: Is it possible to record from multiple video streams using iMovie?
Is it possible to record from multiple video streams using iMovie.
I want to record a presenter on a greenscreen and also his powerpoint slides at the same time and cut from one to other.
Can imovie record from screen and camera at same time?
If so is there a link to somewhere explaining how to do so?
If not, what is the most efficient way to do so, without having to learn a whole complex program?
Please advise asap.
Very many thanksAlan and Anthony,
Thanks for the quick responses. Unfortunately, there is no backup :(.
I will ask if they get logged into the global zone, but one thing I forgot to mention is that this zone (as are all our non-global zones and the global zone also) are configured for ldap logins.
Assuming that they can even try to login to the global zone, can they even see the directory structure in the non-global zone (sorry, I haven't worked with Zones much thus far) from the global zone?
Also, if they can see the non-global zones directory structure, what should they then try?
Also, I've been searching and I've seen some suggestions of running a "pkgcheck -af" which might restore the directory permissions to what the various packages expect. Assuming that they can get to the point that they can at least log into the zone, is that something that would work?
I'm setting up a new test Solaris box now, with a zone, to try to reproduce the problem. If I can reproduce the problem, I'll post back whether or not I see the same thing.
In the meantime, if anyone has any suggestions, please post them.
Thanks,
Jim
P.S. In case you're wondering, the box/zone that got messed up was a test/integration zone, and they were in the process of installing some software when this chmod happened. -
First, how do I create my own favorite theme template for DVD slideshows? I used to be able to select this from pulldown menu, but cannot now do so. I am directed straight to already existing themes, which take more memory. I have a large slideshow, and need all the space I can get. I just want to use a picture as my DVD cover, and then insert a slideshow. Also, when I try to burn my 8.5gb double sided slideshow, all that burns is the music. It is a large slideshow, a memorial on the life of my now deceased brother. This means a lot to me and to my family, and I am having so much trouble trying to burn it. I have gone into Project View and selected appropriately. The bar shows I have room to burn this DVD, but it does not burn. I have burned so many DVDs in the past, but this one just will not burn. I am so confused at this point. I will say this is the first 8.5gb I have attempted to create and burn. My specs list a 7.7gb or 4.7gb as operable....but there are no 7.7gb dvds. I had to purchase 8.5gb. Help? What am I doing wrong? I have spent so much time on this, and just cannot figure it out.
Final Cut is a separate, higher end video editor. The pro version of iMovie.
Give iPhoto a look at for creating the slideshow. It's easy to assemble the photos in an album in iPhoto, put them in the order you want and then make a slideshow of them. You can select from various themes and transitions between slides and add music from your iTunes library.
When you have the slidshow as you want use the Export button at the bottom of the iPhoto window and export with Size = Medium or Large.
Save the resulting Quicktime movie file in your Movies folder.
Next, open iDVD, choose your theme and drag the QT movie file into the menu window being careful to avoid any drop zones.
Then follow this workflow to help assure the best qualty video DVD:
Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image menu option. This will separate the encoding process from the burn process.
To check the encoding mount the disk image, launch DVD Player and play it. If it plays OK with DVD Player the encoding is good.
Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality. Always use top quality media: Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
The reason I suggest iPhoto is that I find it much easier to use than iMovie (except for the older iMovie 6 HD version). Personal preferences showing here. -
Is there any way to name the records from a data merge?
I have a spreadsheet, that has all the names for the images I'm using for a data merge. What I want to do is name the resulting records after the filenames in one of the columns in the spreadsheet. Is there anyway to do this? Or is there some other way to individually name the records from a data merge? I don't have any scripting prowess, so I can't really mess with that. Any help is greatly appreciated! Thanks!
You merge it along with the others, just like any field. ID cannot do the naming for you during the merge, but most spreadsheets have lots of logic capabilities that should allow you to extract a name for the record from the filename in the column of your choice. The only reason ID knows to find the image instead of writing the filename is that you've used a special name for the field.
Maybe you are looking for
-
White iMac Intel with 10.4.1 takes 40 seconds to sleep after clicking on it
My dad's machine (after a restart) will take under 3 seconds to go to sleep after the command...but after checking email and unloading camera or some surfing- for some reason it takes almost 40 seconds. I reduced spotlight's things to check, removed
-
How to get IDoc number using sdata records
Hi Experts, I have executed a report program in background. Its generating few IDoc's. I can view those idoc's in WE05 also. But now i want to display those idoc number in the result output of the report. One of the segment having materrial number an
-
How to populate the Tree having Directories only like Explorer
Hello, Can u guys tell me how to populate the File Structure Tree which is having directories only like Explorer Thanx in advance !! Vijay Gupta
-
DeployJava.runApplet & JRE 8
I have the latest/greatest JRE 7 (1.7_51) installed. This is the at the 1.7 security baseline. In my web page I am trying to launch an applet that runs on 1.7 like this: var version = '1.7'; deployJava.runApplet(attributes, parameters, version); I a
-
Benefits userexit for insurance plans
Hi, I am working on modifying an benefit userexit (ZXPBEU08). To evaluate the EECost and ERCost, I need to obtain the service years for the employee, it comes from infotype 41. How can I grab that information in this userexit? When I added the code r