| |

VerySource

 Forgot password?
 Register
Search
Author: huhejun

How should this table be related? ? ?

[Copy link]

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-17 15:00:01
| Show all posts
A simpler
Add a record (id, drug name, price) to a (0, no item, 0)
b Add a record as above (id, treatment item, price) (0, no item, 0)
c table contains id_1 (set foreign key association a.id, defaut 0)
           id_2 (Set the foreign key association b.id, defaut 0)

Use c as the main table and as the data window;
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-17 20:15:01
| Show all posts
The cost classification must be included in the two tables, then the two result sets can be connected!

select c. time, c. medical treatment number, a.ypnam from a, c where a.ypid=c. expense classification
union
select c. time, c. medical treatment number, b.zlname from b, c where b.ypid=c. expense classification
In this way, you don't need to care if there is any.
Reply

Use magic Report

0

Threads

16

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-8-28 22:00:01
| Show all posts
I don't know, Bangding
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-29 16:45:01
| Show all posts
select a.ypname,b.zlname,c.* from a,b,c where a.ypid(+)=c.ypid and b.zlid(+)=c.zlid
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-29 17:15:01
| Show all posts
The premise is that ypid and zlid cannot be repeated, and the char type can be used, with characters in front of it to distinguish, such as: yp00001, zl00001

select c. time, c. medical treatment number, a.ypname as cost
from c,a
where c. Expense classification = a.ypid
To
union

select c. time, c. medical number, b. zlname as cost
from c,b
where c. Expense classification = b.zlid
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list