I want to Join different tables based on column value if [dbo].[fin_FixedAssetRegister].TransactionType = ‘IOD’ then join [dbo].[sms_IssueOrderDetail] if [dbo].[fin_FixedAssetRegister].TransactionType = ‘GRND’ then join [dbo].[sms_GoodsReceivedNoteDetail] if [dbo].[fin_FixedAssetRegist…
Tag: sql
Column ‘Book.Title’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
I’m creating a Library Management System and in the database I want to display book ISBN, Title and No. of copies of each book with their located library. Here’s the code I tried : It gives me the error Column ‘Book.Title’ is invalid in the select list because it is not contained in ei…
Replacing a subquery in a PL/SQL trigger
I have 2 tables. One called Employee and the other Employee_jobs. One of the fields in the Employee table is job_name. The Employee_jobs table contains 2 fields, job_name, and Emp_count (number of employees per job). What i’m trying to do is whenever i perform an operation on the Employee table then it …
Case statment with join-sql
I have a table User which has many messages and many contacts. The relation between messages and contacts table is made trough contactMessages table. Table messages has a foreign key on contactMessages which is the message_id Table contacts has a foreign key on contactMessages which is the contact_id Each mes…
Provide an SQL in oracle The conflict column should be yes if same id is found in inc and dec list for each name else the conflict should show no [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Answer You can use the analytical function as follows:
Unpivot or transform data using MS Access Query
Good afternoon guru’s! I’m hoping someone with Access & SQL experience (and time) would be able to write some SQL code that I could use in MS Access to transform/unpivot some data. I guess it’s a bit like a an unpivot. Current table “tbl_Weekly_Forecast” is structured like th…
Select from multiple tables with group and join
i have 4 tabels drinks, opskrifter, ingredients and stock the tables consist of drinks drink_id name beskriv glas image alcohol opskrifter drink_id ingredient_id quantity ingredients ingredient_id name stock ingredient_id name i want a query to select drinks that can be made in opskrifter of the ingredients i…
Generate date from sunday except the existing value, in 1 Week Range
This is the result of my query right now with data getting 1 result only. This is my query: $merid=20; I am trying to populate to get the dates the full week beginning Sunday except the existing Tuesday . Can someone give guidelines on where to begin? Is the logical process can be done here in SQL or do I
How to update one column of table with 8 million rows of data in PostgreSQL
I have a table with about 20 columns. It currently holds 8 million rows of data. I need to update one NULL column for all 8 million rows, it is a GUID column and a FK for another table column. Currently, I am running simple update query in a loop. But it is taking way too long. Answer Updating 8
Oracle SQL select, compare 2 listagg’s values
I have two tables: one is TEXT_MSG with column ROLES, another one is USERS with column ROLES. Columns ROLES is listagg VARCHAR2, separator is : symbol. It is possible to write SQL statement with WHERE clause to get records from USERS table WHERE one or many roles from TEXT_MSG.ROLES equals role/s from USERS.R…