Skip to content

Tag: sql-server

How to calculate Sum and Subtraction from two different table

I have two table “tbl_In_Details” and “tbl_Out_Details” Sample data for tbl_In_Details Now i want to calculate current stock i.e. (incoming – Outgoing) as Current_Stock i tried in such a way but not getting proper record please guide me where i need to modify my query: My output …

Use empty table in SQL query

I have created a new SQL table of two column [Lot_no, Comment] which is empty. I have another table of two column [Lot_no, Product_Code] which has values. Problem: I want to create a SQL query where I retrieve [Lot_No|Product_Code|Comment] for some [Lot_No] but since no data is available for comment in first …

Should I create a Joint table or add foreign key

I’m busy designing a database for my app, I made the relationship between tables… and after, I realized that instead of using foreign key and place it in another table I can only use a new joint table that will contain primary key for each table. Not sure if any one used to achieve it? Also Micros…

Operand data type varchar is invalid for avg operator

I keep getting the above error message “Operand data type varchar is invalid for avg operator” Can anyone fix it for me? PLEASE Thanks in Advance Answer Actually, the problem is that the implementation is incorrect. You don’t want to average timestamps (5h:3m:20s), but durations. Hence, you …