advanced delete query sql

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default advanced delete query sql

    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#

    (thanks 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





    kabbi~thkek Guest

  2. Similar Questions and Discussions

    1. Where to find: Advanced Query Wizard
      you can find a link to the Advanced Query Wizard on the Adobe Exchange, but under the given link there is no more any software to find. Does anyone...
    2. Need Help with Advanced SQL Query
      It's advanced for me, at least. I have three tables that I need to use: Product (product_id and product_title are the fields) shipRegion...
    3. Help with delete query please
      Hi Having problem with delete query. Below is query: $unconfirmedstatus = 'Unconfirmed'; $firstquery = "DELETE FROM Pendingsales WHERE time <...
    4. Delete row in query
      Hello, I hope you'll be able to help me with this simple question. There is a query created dinamically with QueryNew(), and then moved to a...
    5. variable empty after after posting a delete query
      The variable contains: delete from divisies where divisieid='1c' After posting it contains: delete from divisies where divisieid= So the part...
  3. #2

    Default Re: delete items query sql

    Hello,

    Nobody has an Idea how I could do this?

    Gr, Kabbi
    kabbi~thkek Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139