code or Query

A

a

thank you

ID ID2 Playername Exp1
1 null a b c d
2 1 alitrf abcd
3 1 addf abcd
4 null dfsadfas
5 4 arrt dfsadfas

Explanation

Id contain serial Number (1,2,3,4,5….etc)
ID2 contain number from (ID)
Playername (any people playername)
Exp1 this is expression (what should this expression do):
If ID2 = and (ID) then
(Exp1) value = the playername of (ID)
End if

Explain again as you see in the table above for example (ID = 1) and (ID2=
1) in some row
the exp1 should take the (playername) of ID=1

what should I do to solve this problem
 
D

Douglas J. Steele

I'm assuming your table (let's call it Players) only has fields ID, ID2 and
Playername in it. To get what you're trying to get, you can use a query
along the lines of

SELECT A.ID, A.ID2, A.Playername, B.Playername AS Exp1
FROM Players AS A LEFT JOIN Players AS B
ON B.ID = A.ID2

To built this query through the query builder, create a new query.

Add table Players to the table twice (when you do this, one of the tables
will end up being labelled as Players_1)

If there are any lines joining the two tables, delete them

Drag the ID2 field from the table named Players on top of the ID field in
the table named Players_1. That will create a line joining the two tables on
those fields. Select the line so that it's highlighted, right-click and
select Join Properties. You'll see three choices like

Only include rows where the joined fields from both tables are equal

Include ALL records from 'Players' and only those records from 'Players_1'
where the joined fields are equal

Include ALL records from 'Players_1' and only those records from 'Players'
where the joined fields are equal

Choose the opton "Include ALL records from 'Players' and only those records
from 'Players_1' where the joined fields are equal". When you do that,
you'll see that an arrow will be added to the line at the Players_1 end.

Drag the three fields from table Players into the grid, plus the Playername
field from table Players_1

Run the query, and you should see the results you asked for.
 
A

a

wowwwwwwwwwwwwwwwwwwwwwwwwww

it'w wonderful
thank you for your great efforts

thank you Mr Eng Douglas J. Steele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top