[Solved] SQL querying – Doctors and Hospitals [closed]

I’ll help you with your first question, and I’ll leave to you the second. Display doctorid, dname, total fees received by the doctor(s) who have treated more than one patient? Let’s split this problem in pieces: So you need first to know which doctors have treated more than one patient. That information is in the … Read more

[Solved] SQL querying – Doctors and Hospitals [closed]

Introduction SQL querying is a powerful tool for managing data in a database. It is used to retrieve, manipulate, and store data in a database. In this article, we will discuss how to use SQL querying to manage data related to doctors and hospitals. We will look at how to query data related to doctors, … Read more

[Solved] Need help to UPDATE TABLE [closed]

you are saying that on change in four table you want to update the record in 5th table. For this purpose you can write an update trigger which will trigger on change on any one of the four tables and check if the needed values in four tables are updated and it will change accordingly … Read more

[Solved] Fetching VB Variables to insert with SQL Query [closed]

To link VB variables to an SQL query, you need to add parameters that store the variables and then use those parameters in your SQL command: Using parameters MyCommand = New SqlCommand(“SELECT Height, Weight, DoB, Gender, FROM `User` WHERE Username = @Username”, DatabaseConnection) MyCommand.Parameters.AddWithValue(“@Username”, Username) UPDATE: How to connect to database ‘Leads to the database … Read more

[Solved] SQL Database Algorithm

Even though this question is Way too broad, and actually not asking anything, i’ll give it a few minutes of attention. 1) You backup the current state and work on a Sandbox! 2) if your only need is few reports, i guess you can generate them query the different databases independently and maybe post processing … Read more

[Solved] HOW TO SUBSTRING in SQL QUERY

Just check this sample , you have to use charindex(to find the index of comma) and substring function to get substring value Declare @var varchar(50) = ‘21699,21712’ select charindex( ‘,’, @var), substring ( @var, charindex(‘,’, @var)+1, len(@var)) you can also use this too: declare @var varchar(50) = ‘21699,21712’ select charindex( ‘,’, @var), substring ( @var, … Read more

[Solved] Convert SQL into LINQ and Lambda

Maybe something like this: var result= ( from s in db.Stands join cp in db.ContractProducts on s.Id equals cp.StandId join p in db.Products on cp.ProductId equals p.Id where s.EventId == 1 group p by p.Description into g select new { Description=g.Key, TotalArea = g.Sum (x =>x.TotalArea) } ).ToList(); Where db is the linqdatacontext 1 solved … Read more

[Solved] Slightly Complicated SQL query

Something like this should return the specified resultset: SELECT u.id AS user_id , u.user_name , SUM(a.user_id IS NOT NULL) AS total_count_of_articles FROM users u LEFT JOIN users_articles a ON a.user_id = u.id GROUP BY u.id, u.user_name ORDER BY total_count_of_articles DESC 2 solved Slightly Complicated SQL query