Select query for dates
Hi All,
Could you please help with a SELECT query to retrieve the following dates ...
sysdate - 1
sysdate,
sysdate + 1
Sorry for the miscommunication .. I wanted these dates in a single column as given below
21-May-2012
22-May-2012
23-May-2012
Regards,
Jitesh Gurnani
Edited by: Jitesh Gurnani on May 22, 2012 2:53 AM
>
Sorry for the miscommunication .. I wanted these dates in a single column as given below
21-May-2012
22-May-2012
23-May-2012
>
select sysdate - level + 2
from dual
connect by level <= 3
order by 1Edited by: Paul Horth on 22-May-2012 02:59
Similar Messages
-
hi friends,
i am facing a problem with my slect statement. i need to get details greater than the date given in select stmt, but i'm not geting it. please do help me .
select ebeln
bsart
aedat
ernam
lifnr
from ekko
into table it_ekko
where ebeln eq ekko-ebeln
and aedat gt '20080424'
and bsart <> 'AN'
'20080424'
and frggr is null or frgsx is null or frgke eq '1'.hi Kat,
do this way ..
data : v_date like ekko-aedat value '20080424'.
select ebeln
bsart
aedat
ernam
lifnr
from ekko
into table it_ekko
where
*ebeln eq ekko-ebeln
and aedat gt v_date
and bsart 'AN'
and ( frggr is null or
frgsx is null or
frgke eq '1' ) .
Regards,
santosh -
Cm:select content query for date
Hi,
does anyone know how to form the query in the cm:select tag for dates.
i want to do something like this but it does not work that way:
<cm:select query="type = 'news' && date > 05.10.2002" ...>
thanks for any help.Please post this to the Portal newsgroup.
ronald ploeger wrote:
> Hi,
>
> does anyone know how to form the query in the cm:select tag for dates.
>
> i want to do something like this but it does not work that way: <cm:select query="type
> = 'news' && date > 05.10.2002" ...>
>
> thanks for any help.
Regards,
Ann
Developer Relations Engineer
BEA Support
-
Query to find first and last call made by selected number for date range
Hi,
query to find first and last call made by selected number for date range
according to filter:
mobile_no : 989.....
call_date_from : 25-april-2013
call_date_to : 26-april-2013
Please helpHi,
It sounds like you want a Top-N Query , something like this:
WITH got_nums AS
SELECT table_x.* -- or list columns wanted
, ROW_NUMBER () OVER (ORDER BY call_date ) AS a_num
, ROW_NUMBER () OVER (ORDER BY call_date DESC) AS d_num
FROM table_x
WHERE mobile_no = 989
AND call_date >= DATE '2013-04-25'
AND call_date < DATE '2013-04-26' + 1
SELECT * -- or list all columns except a_num and d_num
FROM got_nums
WHERE 1 IN (a_num, d_num)
;This forum is devoted to the SQL*Plus and iSQL*Plus front ends. This question doesn't have anything to do with any front end, does it? In the future, you'll get better response if you post questions like this in the PL/SQL.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the SQL forum FAQ {message:id=9360002} -
Can any one send select query for this?
Hi,
can any one plese send select query for the following query.please send as early as possible.
Loop through the I_BSID internal table to fill records in I_OUTPUT.Combine data from I_BSID, I_KNKK, I_KNKK_KNKLI, I_KNA1 and I_KNVV into I_OUTPUT based on the linking conditions .Field Description Source are
I_OUTPUT-BUKRS Company code I_BSID-BUKRS
I_OUTPUT-KUNNR Customer number I_BSID-KUNNR
I_OUTPUT-NAME1 Customer Name I_KNA1-NAME1
I_OUTPUT-KNKLI Credit account I_KNKK-KNKLI
I_OUTPUT-KDGRP Customer Group I_KNKK-KDGRP
I_OUTPUT-KLIMK Credit Limit I_KNKK_KNKLI-KLIMK
I_OUTPUT-KVGR1 Business Unit I_KNVV-KVGR1
I_OUTPUT-REBZG Invoice Number I_BSID-REBZG
I_OUTPUT-BLDAT Invoice Date I_BSID-BLDAT
I_OUTPUT-WAERS Document Currency I_BSID-WAERS
I_OUTPUT-DUE_DATE Due Date Based on below
Calculation
Get the Payment terms days combining I_BSID and I_T052 based on the linking conditions mentioned above. Note : a) Baseline Date : If baseline date I_BSID-ZFBDT is blank , use the Document Date.b) Payment Term Days :If I_BSID-ZBD3T is not blank, take this as Payment Term Days for Due date calculation.
If I_BSID-ZBD3T is Blank, then get payment term days from I_T052 based on I_BSID-ZTERM. If there are more than one record in I_T052 for the given Payment term, get the day part from baseline date and select the first record where the day limit I_T052-ZTAGG is greater than the day part.If I_BSID-ZBD3T is blank and I_BSID-ZTERM is also blank, then take Y000 (Due Immediately) as Payment term and proceed with the above logic. Set the payment term field blank while printing.
Calculate Due date : For Debits, Determine Due Date = Baseline Date + Payment term Days(not discount days) For Credits Due date = Baseline date.Then, move the amount I_BSID-DMBTR to respective buckets (Not yet Due, Current Due, Past due 1-30, Past Due 31-60 etc.) Based on the due date.
Thanks&Regards,
praveen kumar.AHI,
To get Open Items you can use Function module:
data:i_items TYPE STANDARD TABLE OF rfpos.
CALL FUNCTION 'CUSTOMER_OPEN_ITEMS'
EXPORTING
bukrs = p_bukrs
kunnr = wa_customer-kunnr
TABLES
t_postab = i_items
EXCEPTIONS
no_open_items = 1
OTHERS = 2.
Table I_items will have all the open items for that Customer in the given company code.
Well for Clear Items: Try
GET_CLEARED_ITEMS or FMITPOFM_CLEARED_ITEMS_GET.
Hope it helps.
Manish -
Select query for fetching from 3 tables.
Can we have a single Select query for fetching same fields (kappl,kschl,vkorg,vtweg,spart,kunwe,datbi,knuma,datab,knumh)
from 3 tables >> KOTE707,KOTE708 and KOTE709 into an internal table for a particular KUNNR?
Regards,
Shashank.Hi,
If you have kunnr field in all the 3 tables then it is possible. use inner join as below
PARAMETERS: p_cityfr TYPE spfli-cityfrom,
p_cityto TYPE spfli-cityto.
DATA: BEGIN OF wa,
fldate TYPE sflight-fldate,
carrname TYPE scarr-carrname,
connid TYPE spfli-connid,
END OF wa.
DATA itab LIKE SORTED TABLE OF wa
WITH UNIQUE KEY fldate carrname connid.
SELECT c~carrname p~connid f~fldate
INTO CORRESPONDING FIELDS OF TABLE itab
FROM ( ( scarr AS c
INNER JOIN spfli AS p ON p~carrid = c~carrid
AND p~cityfrom = p_cityfr
AND p~cityto = p_cityto )
INNER JOIN sflight AS f ON f~carrid = p~carrid
AND f~connid = p~connid ).
LOOP AT itab INTO wa.
WRITE: / wa-fldate, wa-carrname, wa-connid.
ENDLOOP.
<b>Reward Points if this helps,</b>
Satish -
Select-options for date field.
Hi all,
i need to give select options for Date field.How can i give that.
Thanks & Regards
Ravi.Hi Ravi,
Use the Component WDR_SELECT_OPTIONS to include select options in Web Dynpro ABAP. Follow these steps:
1. In your Component , "Used Componet" tab add Component WDR_SELECT_OPTIONS . Component Use can be any name that you want to give, eg SELECT_OPTIONS
2. Go to the View where you want to include the Date Select Options. I am assuming that you already have an Attribute of Type DATS in your context.
3. View: Properties Tab:Create Controller Usage and select
SELECT_OPTIONS WDR_SELECT_OPTIONS
SELECT_OPTIONS WDR_SELECT_OPTIONS INTERFACECONTROLLER
4. View Layout Tab:Include a View Container. In this view container we will show the Date Select Options.
5. View Attributes Tab: Create Following two attributes:
M_HANDLER type IF_WD_SELECT_OPTIONS
M_WD_SELECT_OPTIONS type IWCI_WDR_SELECT_OPTIONS
6: View Methods Tab: Create a method eg CREATE_SELECTION_SCREEN. Call this method in the WDDOINIT of the view.
7:CREATE_SELECTION_SCREEN: Write following Code:
* Data Declaration
data:
lt_range_table TYPE REF TO DATA.
data:
lr_componentcontroller TYPE REF TO IG_COMPONENTCONTROLLER,
lr_componentusage TYPE REF TO IF_WD_COMPONENT_USAGE.
* Execution
* Create Used Component
lr_componentusage = wd_this->wd_cpuse_select_options( ).
if LR_COMPONENTUSAGE->HAS_ACTIVE_COMPONENT( ) is initial.
lr_componentusage->create_component( ).
endif.
* Get pointer to interface controller of select options
wd_this->M_WD_SELECT_OPTIONS = wd_this->wd_cpifc_select_options( ).
* initialize selction screen
wd_this->M_HANDLER = wd_this->M_WD_SELECT_OPTIONS->init_selection_screen( ).
* Create Range Table for: Date
CALL METHOD WD_THIS->M_HANDLER->CREATE_RANGE_TABLE
EXPORTING
I_TYPENAME = 'DATS'
RECEIVING
RT_RANGE_TABLE = lt_range_table.
* Add Selection Field for: Date
CALL METHOD WD_THIS->M_HANDLER->ADD_SELECTION_FIELD
EXPORTING
I_ID = '<name of date attribute in the context>'
* I_WITHIN_BLOCK = MC_ID_MAIN_BLOCK
* I_DESCRIPTION =
* I_IS_AUTO_DESCRIPTION = ABAP_TRUE
IT_RESULT = lt_range_table
* I_OBLIGATORY = ABAP_FALSE
* I_COMPLEX_RESTRICTIONS =
* I_USE_COMPLEX_RESTRICTION = ABAP_FALSE
* I_NO_COMPLEX_RESTRICTIONS = ABAP_FALSE
* I_VALUE_HELP_TYPE = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_NONE
* I_VALUE_HELP_ID =
* I_VALUE_HELP_MODE =
* I_VALUE_HELP_STRUCTURE =
* I_VALUE_HELP_STRUCTURE_FIELD =
* I_HELP_REQUEST_HANDLER =
* I_LOWER_CASE =
* I_MEMORY_ID =
* I_NO_EXTENSION = ABAP_FALSE
* I_NO_INTERVALS = ABAP_FALSE
* I_AS_CHECKBOX = ABAP_FALSE
* I_AS_DROPDOWN = ABAP_FALSE
* IT_VALUE_SET =
* I_READ_ONLY = ABAP_FALSE
* I_DONT_CARE_VALUE =
* I_EXPLANATION =
I_TOOLTIP = 'Select Date'.
8: To Fetch Data entered in the selection field, write following code on action of button click:
data:
lt_date type REF TO DATA.
FIELD-SYMBOLS:
<fs_date> TYPE table.
* retrieve Date from Select Options
CALL METHOD WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD
EXPORTING
I_ID = '<attrib_name>'
RECEIVING
RT_RANGE_TABLE = lt_date.
* assign Date Field Symbol
ASSIGN lt_date->* to <fs_date>.
9: Windows Window Tab: In the View Conatiner, embed the WND_SELECTION_SCREEN view from SELECT_OPTIONS component Usage of WDR_SELECT_OPTIONS component.
Regards,
Reema. -
Select Query for smart form-invoice
Hi Folks,
I have to fetch the following fields as per the requirement for desiging a invoice smartform.I had copied lb_bill_invoice smartform into z format.
Can anyone here please give me the select query for the same.
fields to fetched are as follows:-
1.vbrp-arktx,
2.vbrp-fkimg,
3.konv-kbetr with respect to vbrk-knumv
4.konv-kwert.
And also what all I have to give in format interface and global definitions of the smartform.
please help me in this regard.
Points will be given.
K.Kiran.Hi,
declare the variables V_arktx(40) and v_Qty like vbrp-fkimp and other varaibles for Kbetr, kwert, knumv on the global definitions.
select single arktx fkimg into (v_arktx, v_qty) from vbrp
where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
select single knumv into v_knumv from vbrk where where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
this select has to fire in the item level and in the loop.
so have to write in the correct place.
select kbetr kwert into (v_kbetr, v_kwert) from konv
where where knumv = v_knumv and kposn = LBBIL_IT_REFPURORD-ITM_NUMBER.
regards,
anji -
How to write selection Query for the following requirment.
Hi All,
I am new to ABAP, I need a help ,
I need to select all plants(WERKS) from MARC at Plant/Material level,
then I need to take all sales organozation(VKORG) from T001w,
then I need the company code(BUKRS) from TVKO based on VKORG,
then I need the currency key(WAERS) from T001 based on BUKRS,
Can any one help me in writing selection Query for the same?
Thanks All,
Debrup.Hi,
Its easy for you if you learn SELECT with JOIN to complete your task. So SEARCH the forum with SELECT statement and you will get a lot of examples using which you can write your own.
If you struck up anywhere revert back.
Regards
Karthik D -
i want give default values in select option for date (for a period)
I used
SELECT-OPTIONS y_s_mnth FOR y_v_dt_month default first to last OPTION BT.
first and last are dates.
I am getting error dialog box....specify ranges...
Please give sample code..Hi Suhas,
I hope this code will help you. Reward me if it is helpful.
select-options : y_s_mnth FOR sy-datum.
initialization.
y_s_mnth-sign = 'I'.
y_s_mnth-option = 'BT'.
y_s_mnth-low = sy-datum - 30. "first_day
y_s_mnth-high = sy-datum. "last_day
append y_s_mnth.
clear y_s_mnth.
Regards,
Sagar -
Regading Select query for Inspection planed date
Hi,
I am working on one object.I need to select query to get the inspection plan valid from date(PLKO-DATUV).Logic is Find the group counter(QALS-PLNNR),Group counter(QALS_PLNAL) based on materail(SELMATNR) & BATCH(CHARG) and get the inspection plan valid from date(PLKO-DATUV).How to write the select performance wise.Please help me.
Regards,
Sujanhi Kat,
do this way ..
data : v_date like ekko-aedat value '20080424'.
select ebeln
bsart
aedat
ernam
lifnr
from ekko
into table it_ekko
where
*ebeln eq ekko-ebeln
and aedat gt v_date
and bsart 'AN'
and ( frggr is null or
frgsx is null or
frgke eq '1' ) .
Regards,
santosh -
Select query for char data type
Hi Gurus,
I am trying to fetch records from Z table.
Below the select query.
lv_low = '0900001'
lv_high = '0900002'
select matnr sernr into table lt_sernr
from zsd_upd_deldoc
where sernr >= lv_low and sernr <= lv_high.
but out put shows
9000010
9000011
900002
900001
9000010
9000019
9000019
9000018
9000017
9000014
9000018
9000017
Expecting O/P
900001
900002
Regards
Vinayak Sapkaltables: zsd_upd_deldoc.
data: begin of lt_table occurs 0,
sign(1),
option(2),
low(18),
high(18),
end of lt_table.
DATA: ls_doc_id_range LIKE LINE OF lt_table.
FIELD-SYMBOLS: <fs> LIKE LINE OF lt_table.
ls_doc_id_range-sign = 'I'.
ls_doc_id_range-option = 'BT'.
ls_doc_id_range-low = lv_low.
ls_doc_id_range-high = lv_high.
INSERT ls_doc_id_range INTO TABLE lt_table.
select matnr sernr into table lt_sernr
from zsd_upd_deldoc
where sernr >= lv_low and sernr <= lv_high.
select matnr sernr into table lt_sernr
from zsd_upd_deldoc
where sernr in lt_table.
loop at lt_sernr assigning <fs_sernr>.
write: / <fs_sernr>-sernr.
endloop.
O/P
9000010
9000011
900002
900001
9000010
9000019
9000019
9000018
9000017
9000014
9000018
9000017
Regards
Vinayak Sapkal -
Select query for fields in selection screen
SELECT * FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
and begdat in date_ran.
and enddat in date_ran
How can I rewrite the above query for high and low ranges of date_ran field in condition? It doesn't allow in operator with date_ran-low.Can u please help me outHi
rahul
SELECT *
FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
and begdat = date_ran-low
and enddat = date_ran -high.
u can write like this or i amnot getting why u r expliciting this date u can give directly as
SELECT *
FROM hrus_d2
INTO TABLE ta_list
WHERE us_name IN subs_obj
date in date_ran.
plzz reward if i am usefull to u in any way.. plzz dont forget to reward -
Issue with select query for secondary index
Hi all,
I have created a secondary index A on mara table with fields Mandt and Packaging Material Type VHART.
Now i am trying to write a report
Tables : mara.
data : begin of itab occurs 0.
include structure mara.
data : end of itab.
*select * from mara into table itab*
CLIENT SPECIFIED where
MANDT = SY-MANDT and
VHART = 'WER'.
I'm getting an error
Unable to interpret "CLIENT". Possible causes of error: Incorrect spelling or comma error.
if i change to my select query to
*select * from mara into table itab*
where
MANDT = SY-MANDT and
VHART = 'WER'.
I'm getting an error
Without the addition "CLIENT SPECIFIED", you cannot specify the client field "MANDT" in the WHERE condition.
Let me know if iam wrong and we are at 4.6c
ThanksLike I already said, even if you have added the mandt field in the secondary index, there is no need the use it in the select statement.
Let me elaborate on my reply before. If you have created a UNIQUE index, which I don't think you have, then you should include CLIENT in the index. A unique index for a client-dependent table must contain the client field.
Additional info:
The accessing speed does not depend on whether or not an index is defined as a unique index. A unique index is simply a means of defining that certain field combinations of data records in a table are unique.
Even if you have defined a secondary index, this does not automatically mean, that this index is used. This also depends on the database optimizer. The optimizer will determine which index is best and use it. So before transporting this index, you should make sure that the index is used. How to check this, have a look at the link:
[check if index is used|http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21eb3a446011d189700000e8322d00/content.htm]
Edited by: Micky Oestreich on May 13, 2008 10:09 PM -
Ms access 2007 between query for date
Dear All,
I am using the below query to fetch records from a table between two dates
select * from tablename where Format([VisitDate],"Short Date") >=Format(#01/10/2014#,"Short Date") and Format([VisitDate],"Short Date") <=Format(#31/10/2014#,"Short Date")
I want records between 1st Oct to 31st Oct only, but the above query shows Nov and December data also. Please let me know where I am going wrong.
Regards,
Noor
Thanks & Regards, Noor HussainThe Format function returns a string expression, so the comparison is on that basis not on the date value. You do not need to worry about the format at all as the date/time data type in Access is implemented as a 64 bit floating point number.
You can see it in whatever date/time format you wish, but the underlying value is always the same. When you include a date literal in an SQL statement or in VBA code it must be either in US short date format (mm/dd/yyyy), or in an internationally unambiguous
format. The ISO standard format for date notation of YYYY-MM-DD is a good choice. So you query would be:
SELECT *
FROM tablename
WHERE VisitDate >= #2014-10-01#
AND VisitDate < #2014-11-01#;
Note that the range is defined as on or after the start date and before the day following the end date. This ensures that all relevant rows are returned. As there is no such thing in Access as a 'date value', but only a 'date/time value' it is possible
that a 'date' of 31 October 2014 could have a non-zero time of day element unless you have taken steps in the table definition to specifically exclude values with a non-zero time of day. Such date/time values would not fall within a range ending <=
#2014-10-31#, so would not be returned by the query. Defining the end of the range with < #2014-11-01# ensures that such rows are returned.
Ken Sheridan, Stafford, England
Maybe you are looking for
-
My icloud would not back up because I was too close to the 15gb I had purchased. I then removed 1,000 photos from the phone and opened up several GB (in theory) to make room on my icloud. However, icloud is not recognizing I did so wont back up. B
-
ITunes 7 Unknown Error Msg (-200)
I have downloaded iTunes 7, but everytime I try to open it, I get this error message: "The iTunes application could not be opened. An unknown error occurred (-200)." I don't know what to do! Any suggestions?
-
Does apple mail need to be re-configured?
Suddenly my mail program on my macbook pro won't work with my time-warner Time warner says I have to change my preferences in mail
-
Reader Preferences-Internet-Connection Speed: What does this do?
Can someone explain what exactly this setting controls or manages? When I search I see different mentions of what this setting controls, from only controlling multimedia to controlling how fast the .pdf actually opens. The latter makes no sense; why
-
Close the ADF popup window from deployed JSP in other server
I am attempting to open jsp page which one is deployed on tomcat server in adf pop up window from cmd button event.and this first jsp will forward to second jsp and i should able to close from pop window from second jsp close button. This is what i d