I suggest you to first try as select statement to see if you can create a select statement of what the fee would be. Turning select statement into update is usually not hard, but it always helps to first try a SELECT to see the result before the actual update.
why update function cant related 2 table?
I have 2 table which first is header of Commodity purchase information and second is Information on the purchase of goods. in second table i have fee of my goods and I need to change fee of goods of in some number of first table for example update fee from first table which date of second table between 01.01.2022 an 02.02.2021
first and second table are one form that first is header of purchase and second is item of my purchase
do you think is it possible ?
That's to less on information.
Please post table design as DDL, some sample data as DML statement and the expected result.
Sort by: Most helpful
Hi @gholamreza rezaie
Since the information you provided is not enough, I can only guess that you might to UPDATE using JOIN OR CTE.
Please refer to these two articles : Inserts and Updates with CTEs in SQL Server (Common Table Expressions) and SQL Server UPDATE JOIN
If not helpful ,still recommend you share us your table structure (CREATE TABLE …) and some sample data(INSERT INTO …) along with your expected result.
thanks for your replying. im sorry i cant understand this " table design as ddl " an this one " some sample as dml"
2 function that i write is two table that i need related with update functin
For this type of question we generally recommend that you post CREATE TABLE statements for your tables (that is what Olaf referred to as DDL), together with INSERT statements with sample data. We also need to know the expected result given the sample.
This permits us to copy and paste into a query window to develop a tested solution. On the other hand, we can't copy and paste from a screenshot.
It also very helpful if you include a short description of why you want that particular result.
DDL = Data Definition Language
DML = Data Modelling Language
Sign in to comment