i am running this sql code: select inquiry.id as inquiryid, inquiry.subjecttext,…
- User
i am running this sql code: select inquiry.id as inquiry_id, inquiry.subject_text, inquiry.response_text, inquiry.searchable FROM
i2ms-debug.inquiry_detail_vw inquiry WHERE inquiry.id IN (71875)with the results returned i want to add to table:
i2ms-debug.inquiry_analytics_vw - Assistant
To add the results of your SQL query to the
i2ms-debug.inquiry_analytics_vwtable, you can use the INSERT INTO statement. Here's an example of how you can do it:sqlINSERT INTO `i2ms-debug`.inquiry_analytics_vw (inquiry_id, subject_text, response_text, searchable) SELECT inquiry.id as inquiry_id, inquiry.subject_text, inquiry.response_text, inquiry.searchable FROM `i2ms-debug`.inquiry_detail_vw inquiry WHERE inquiry.id IN (71875);Make sure you have the necessary permissions to insert data into the
i2ms-debug.inquiry_analytics_vwtable. Replaceinquiry_id,subject_text,response_text, andsearchablewith the appropriate column names in thei2ms-debug.inquiry_analytics_vwtable. - User
- Assistant
The code you shared is the definition of the view
i2ms-debug.inquiry_analytics_vw. It specifies the structure and logic to retrieve data from multiple tables and present it in a consolidated manner.The view
i2ms-debug.inquiry_analytics_vwincludes columns such asinquiry_id,designated_iac,member_id,member_name,member_email, and many more. It joins several tables likeinquiry_tbl,inquiry_notes_tbl,inquiry_analytics_tbl,member_tbl,inquiry_status_tbl,inquiry_type_tbl,inquiry_product_tbl, andinquiry_notable_tblto gather the necessary information for analysis.The view filters out rows where the
statuscolumn is not'DEL'and thetypecolumn is'TINQ'.To add data to this view, you would need to use the
INSERT INTO ... SELECTstatement, as explained in my previous response. - User
SELECT * FROM
i2ms-debug.inquiry_tbl inquiry WHERE inquiry.id IN (71875)how do i update column 'type' as 'TINQ'
- Assistant
To update the
typecolumn in theinquiry_tbltable to 'TINQ' for the row withid71875, you can use the following SQL code:sqlUPDATE `i2ms-debug`.inquiry_tbl SET `type` = 'TINQ' WHERE id = 71875;This code will update the
typecolumn to 'TINQ' in theinquiry_tbltable for the row where theidis 71875. Make sure you have the necessary permissions to update the table.