How to Select Data from different Tables Using Linq
Hi,
I have two different tables, I just want to collect data from tables using Linq to SQL Queries.
The tables looks like This
ID Name ImageUrl
Other Table is
ID EmpID CheckInTime CheckOutTime
What I want to Collect data from CheckInTime and want to place it in a that is in a list view
Same thing I want to do it for CheckOutTime And One thing I want to tell is both tables are joined by a FK EmpID with ID.
What Are the suggestions for me
I have Used this code
var data = from emp in db.Employees
join chk in db.CheckInCheckOuts on emp.ID equals chk.EmpID
select new EmployeeCheckInOut
Name = emp.Name,
ImageUrl = emp.ImageUrl,
CheckIn = emp.CheckInCheckOuts,
CheckOut = emp.CheckInCheckOuts
Here the CheckInCheckOuts is another table, I don't how do I access fields of the Other table "CheckInCheckOuts"
Thank you
Ali
Mitja,
Kind of Tables, I don't Know but I can Tell you that these are Two table, first Table Have Data in It, Name, ImageUrl I have filled this table with names and ImageUrls And are string type.Other Table is for the CheckInTime And CheckOutTime of the employee.
What I need that when I click on the Image button it Should displays The Current Datetime into the label below the Image button.
So I have Problem accessing my CheckInCheckOut Table because I may not have Idea about.Did you understand what I need to do, if you have more question please ask to me.
Thanks
Ali
Similar Messages
-
How to select data from a table using a date field in the where condition?
How to select data from a table using a date field in the where condition?
For eg:
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = '31129999'.
thanks.Hi Ramesh,
Specify the date format as YYYYMMDD in where condition.
Dates are internally stored in SAP as YYYYMMDD only.
Change your date format in WHERE condition as follows.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and bdatu = <b>'99991231'.</b>
I doubt check your data base table EQUK on this date for the existince of data.
Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
data itab like equk occurs 0 with header line.
select * from equk into table itab where werks = 'C001'
and <b> bdatu <= '99991231'.</b>
Thanks,
Vinay
Thanks,
Vinay -
How to select data from a table by passing document number from another tab
How to select data from a table by passing document number from another table.
for eg:-
I want to display name, adres, region from ADRC table
by using field delivery document number
Kind Regards,
Shanbagavalli.SHi Shanbagavalli,
There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
**Consider that you have a Internal table having document number from other table..
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
FOR ALL ENTRIES IN IT_DOC
WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
**Consider that you have 1 document number then
SELECT NAME ADRES REGION FROM ADRC
INTO IT_ADRC
WHERE DOCUMENT_NO = W_DOCUMENT_NO.
Hope this solves your problem.
Regards,
Kunjal -
How to select data from cluster table
hi experts,
I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
please advice.
maniHi Manikandan,
The following code may be helpful to understand how to select the data from cluster table.
Types: Begin of ty_kna1,
Kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_kna1,
begin of ty_bseg,
belnr type bseg-belnr,
kunnr type bseg-kunnr,
end of ty_bseg,
begin of ty_final,
belnr type bseg-belnr,
kunnr type kna1-kunnr,
adrnr type kna1-adrnr,
end of ty_final.
Data: it_kna1 type table of ty_kna1,
wa_kna1 type ty_kna1,
it_bseg type table of ty_bseg,
wa_bseg type ty_bseg,
it_final type table of ty_final,
wa_final type ty_final.
Select kunnr adrnr from kna1 into table it_kna1 where....
if sy-subrc = 0.
select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
endif.
sort it_kna1 by kunnr.
Loop at it_bseg into wa_bseg.
move wa_bseg-belnr to wa_final-belnr.
read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
if sy-subrc = 0.
move: wa_kna1-kunnr to wa_final-kunnr,
wa_kna1-belnr to wa_final-belnr.
endif.
append wa_final to it_final.
clear wa_final.
endloop.
Loop at it_final into wa_final.
write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
endloop.
Reward if useful.
Thankyou,
Regards. -
How to select data from AZure table storage without row key and partition key
Hi
I need to select a data from azure table storage without rowkey and partition key. how in azure storage emulator click query it display all data from that table.
thanks
rajeshHi rajesh,
It seems that you didn't click query data using storage emulator. But I recommend you could use the azure server explore in your VS to view your data and query data. Please see this document (http://msdn.microsoft.com/en-us/library/azure/ff683677.aspx).
And base on my experience, you may need input the command on Azure storage emulator, such as this page(http://msdn.microsoft.com/en-us/library/azure/gg433005.aspx).
Regards,
Will
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hey guys how to fetch data from db table using subroutine
hi guys,
I am fetching data from db table "mcha". now in the follwing code i get it in "HSDAT1_DATE."
now when i read out_tab with key "HSDAT1". it wont come in out_tab-value.plz tell me what is wrong whether some key condition in out_tab or any thing else.
and what should i write in changing && in script.
thanks in advance
FORM DATE_MGF TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
tables :MCHA ,QALS.
DATA : WERKS1 LIKE QALS-WERK.
DATA : HSDAT1 LIKE MCHA-HSDAT.
DATA : DATE(2),
MONTH(2),
YEAR(4).
DATA : HSDAT1_DATE(10).
READ TABLE IN_TAB WITH KEY 'QALS-WERK'.
LOOP AT IN_TAB.
IF SY-TABIX EQ 1.
WERKS1 = IN_TAB-VALUE.
IF WERKS1 NE SPACE.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
SELECT SINGLE HSDAT INTO HSDAT1
FROM MCHA
WHERE WERKS = WERKS1.
DATE = HSDAT1+6(2).
MONTH = HSDAT1+4(2).
YEAR = HSDAT1+0(4).
CONCATENATE DATE '.' MONTH '.' YEAR INTO HSDAT1_DATE.
READ TABLE OUT_TAB WITH KEY 'HSDAT1' .
IF SY-SUBRC = 0.
OUT_TAB-VALUE = HSDAT1.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.Hi,
Let me understanf clearly what you want.
initally mine out_tab is blank
According to you, your table out_tab is blank. And you need to add out_tab-value = HSDAT1_date.
READ TABLE OUT_TAB WITH KEY 'HSDAT1' .
IF SY-SUBRC = 0.
OUT_TAB-VALUE = HSDAT1.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
So, if your table is blank, then read statement will fail.
Please let me know if your table out_tab in blank when you are reading the table and if this table contains any field called HSDAT.
Basically i would like to know your internal table out_tab declaration.
Thanks,
Archana -
Selecting data from a table using Execute Immediate in 9i
Hi,
I was wondering how I would be able to do a SELECT on a table using EXECUTE IMMEDIATE. When I tried it (with the proc below), I got the following below. Can anyone tell me what I am doing wrong?
Using Scott/Tiger I tried this:
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE P2
2 IS
3 v_SQL VARCHAR2(100);
4 BEGIN
5 v_SQL := 'Select * from Emp';
6 EXECUTE IMMEDIATE v_SQL;
7* END;
SQL> /
Procedure created.
SQL> exec p2
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> exec p2
PL/SQL procedure successfully completed.
SQL>
Thanks in advance.
Sincerely,
Nikhil Kulkarni1 CREATE OR REPLACE PROCEDURE P2
2 IS
3 v_SQL VARCHAR2(100);
erec emp%rowtype;
4 BEGIN
5 v_SQL := 'Select * from Emp';
6 EXECUTE IMMEDIATE v_SQL into erec;
7* END;
SQL> / -
# coming when I select data from oracle table using Native SQL
Hi Gurus,
I am selecting 'First name' from oracle table directly using native sql. I am fetching 65000 records but 10+ records having '#' at the end of firstname. For eg: John#.
But oracle team couldn't find '#' in their table for those records. What could be problem?
or what could be the character in oracle which comes as '#' in abap?
Pls help...
SajThanks for replies.
My DB NLS_PARAMETER is AL32UTF8. I am able to pullout data with older version of ojdbc jar file. So I think there is no issue regarding NLS setting.
So please guide me with proper solution as soon as possible. -
How to fetch data from different tables
I have a view created based on Emp table. while querying the employee details i want to display the dept_ description from dept table. how can i do that ??
Regards Abinyou mean when you click on a emp table row you want to display dept. description?
Use the following query in the view so you have all the required information. In the table selectionlistener get the dept. description and display it.
SELECT distinct E.empno, E.ename, E.sal, D.dname
FROM dept D, emp E
WHERE E.deptno = D.deptno
ORDER BY E.empno; -
How to select columns from internal table using 'GUI_DOWNLOAD' ?
Hi,
i am running a report & the fields for output is saved in an internal table which has as many as 10 fields. But I want to select only a few fields for output. There is a option COL_SELECT in function 'GUI_DOWNLOAD'. How to use it. If possible with example.Hai VijayKumar
Try with the following code
tables : mara.
data : begin of it_mara occurs 0,
matnr like mara-matnr,
mbrsh like mara-mbrsh,
mtart like mara-mtart,
meins like mara-meins,
end of it_mara.
parameters : P_mtart like mara-mtart default 'ROH'.
start-of-selection.
perform select_data.
perform download_data.
*& Form select_data
text
--> p1 text
<-- p2 text
FORM select_data .
select
matnr
mbrsh
mtart
meins
from mara into table it_mara
where mtart = p_mtart.
ENDFORM. " select_data
*& Form download_data
text
--> p1 text
<-- p2 text
FORM download_data .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'c:\down.txt'
FILETYPE = 'ASC'
COL_SELECT = 'X'
COL_SELECT_MASK = 'X XX'
TABLES
DATA_TAB = it_mara.
IF SY-SUBRC = 0.
SORT IT_MARA BY MATNR.
ENDIF.
ENDFORM. " download_data
Thanks & Regards
Sreenivasulu P -
How to show data from different tables in database in ADF Jdeveloper 11g R2
Hi,
My requirement is to display the data in the grid (html > table), the data is to be displayed from more than one table in a single grid and thereafter I am supposed to display the sum of some of the records in another table, I am confused about this, plz help.
RajatThe view link is generally used to relate two view objects together in the AMs data model, for example in a master-detail relationship. If you use them properly, ADF takes care of coordinating master/detail records - for example, ensuring that the detail record has the correct FK to the master record.
Have you read the Fusion Developers Guide for ADF? [url http://docs.oracle.com/cd/E26098_01/web.1112/e16182/bcquerying.htm#CEGJCAHC]This section, for example?
John -
Select data from database tables with high performance
hi all,
how to select data from different database tables with high performance.
im using for all entries instead of inner joins, even though burden on data base tables is going very high ( 90 % in se30)
hw to increase the performance.
kindly, reply.
thnksAlso Check you are not using open sql much like distict order by group by , use abap techniques on internal table to acive the same.
also Dont use select endselect.
if possible use up to n rows claus....
taht will limit the data base hits.
also dont run select in siode any loops.
i guess these are some of the trics oyu can use to avoid frequent DATA BASE HITS AND ABVOID THE DATA BASE LAOD. -
Select data from different database
hi,
may I know how to select data from different database?
for example,
I've 2 databases, OracleDB and OracleAR
Connect with OracleAR in SQL*Plus
select * from OracleDB.TableName
does Oracle support this kind of query?
how can I retrieve data from other database while im connecting with
other database?Hi,
Yes, it's possible. No, your syntax won't work.
First of all you have to define a DATABASE LINK inside the DB where you are already connected (in this case OracleAR). Read docs how to do that.
Second thing is the query. It will look like
SELECT * from TableName@<NameOfDatabaseLink>Greetings,
Guido -
How to fetch data from PTREQ tables
I need to display data in the customised webdynpro application from PTREQ tables.
Can anyone help me out how to fetch data from these tables.use the standard modules like
PT_ARQ_REQUEST_CHECK
PT_ARQ_REQUEST_EXECUTE
PT_ARQ_REQUEST_PREPARE -
Read data from ODS table using value mapping
hi all;
can anyone help on how to read data from ODS table using value mappingMudit,
Take a look at this blog,
<a href="/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler">DB Lookup in Mapping</a>
Regards,
Bhavesh
Maybe you are looking for
-
Since downloading OS X Mavericks, my computer has been shutting down midway of starting up. Please help! The problem began after downloading the software free update. Now when I start my computer, it will starts up normal but when the desktop appears
-
Time Machine is Corrupting my External Drives, Sparsebundle on NAS
Started as my timemachine drive getting flagged as locked and read only 6 months ago. Read up on this problem and no great solution so I buy a new drive so I can fix later without deleting my backups. I tried repairing but it can't be repaired by d
-
I have a playlist on my iphone and can't copy it to itunes
I had a playlist on itunes, but i've installed itunes on anothter pc and can't get the playlist from my iphone to that itunes. please help me.
-
Is there an older version of iPhoto I can download to osx 10.4.11?
Is there an older version of iPhoto I can download to osx 10.4.11?
-
Error message -50 while trying to import music -
I have the error message -50 coming up when I am trying to import files from C drive. You have the question: iTunes displays a -69 error when syncing iPod but not anything to do with -50 error message. Are you able to help me out. This only happened