gadjodilo77
Programmer
Hi,
I have two tables:
dev table:
dev_id volgnr type
1 B-05-1001 1(pc)
2 B-05-3001 3(mon)
3 B-05-3002 3(mon)
4 B-05-3003
kop table:
tabelid kop_pc kop_mon
1 1 2
2 1 3
3 1 4
I have a dev table which stands for all the device with there dev_id (primary key and auto increment) there number (volgnr) and the type (1=pc and 3=monitor).
I also have a kop table to be able to attach monitors to computers. As you can see monitor 2,3, and 4 are all attached to computer 1. (kop_mon is the dev_id of table dev an kop_pc is the dev_id of table dev).
With the following query it is possible to select the computers number (volgnr) and the numbers (volgnr) of the attached monitors:
select c.dev_volgnr as comp_nr
, m.dev_volgnr as mon_name
from dev as c
inner
join kop
on kop.kop_pc
= c.dev_id
inner
join dev as m
on m.dev_id = kop.kop_mon
where c.dev_id = #URL.dev_id#
(thank you for the code!!!!)
However What I now want to do is make a query so I can delete one monitor from the kop table without deleting the monitor from the dev table.
I made a page where I query the dev table to show the results for dev_id 1 (the computer). The attached devices are shown into a formfield.
With if / ifelse I select the right formfield and want to delete a monitor (kop_mon 4) from the kop table (I suppose by using the number (volgnr B-05-3003) in any way which is showing in the formfield (FORM.number_fld1)....
Could somebody explain me how I could do this? How would the query look like?
Thank you in advance.
Gr, Kabbi
I have two tables:
dev table:
dev_id volgnr type
1 B-05-1001 1(pc)
2 B-05-3001 3(mon)
3 B-05-3002 3(mon)
4 B-05-3003
kop table:
tabelid kop_pc kop_mon
1 1 2
2 1 3
3 1 4
I have a dev table which stands for all the device with there dev_id (primary key and auto increment) there number (volgnr) and the type (1=pc and 3=monitor).
I also have a kop table to be able to attach monitors to computers. As you can see monitor 2,3, and 4 are all attached to computer 1. (kop_mon is the dev_id of table dev an kop_pc is the dev_id of table dev).
With the following query it is possible to select the computers number (volgnr) and the numbers (volgnr) of the attached monitors:
select c.dev_volgnr as comp_nr
, m.dev_volgnr as mon_name
from dev as c
inner
join kop
on kop.kop_pc
= c.dev_id
inner
join dev as m
on m.dev_id = kop.kop_mon
where c.dev_id = #URL.dev_id#
(thank you for the code!!!!)
However What I now want to do is make a query so I can delete one monitor from the kop table without deleting the monitor from the dev table.
I made a page where I query the dev table to show the results for dev_id 1 (the computer). The attached devices are shown into a formfield.
With if / ifelse I select the right formfield and want to delete a monitor (kop_mon 4) from the kop table (I suppose by using the number (volgnr B-05-3003) in any way which is showing in the formfield (FORM.number_fld1)....
Could somebody explain me how I could do this? How would the query look like?
Thank you in advance.
Gr, Kabbi