I having a non-clustered indexes created in my SQL database server with Include keyword. Please find my non-clustered index created for FACTORS table. if am having a SELECT query like below will my indcxes FACTORS_BKEY_PNO_IDX cover my select query. ( i mean will this index will help my below select query to …
Tag: sql
Excel SQL VBA: adding more than one cmd parameter
I am writing SQL-query, and I get error with string value: I tried to add more than one cmd parameter to solve this problem: But I also get an error. How do I set more than one cmd parameter and use it in my query? Table I am working with: here. Answer The parameter to CreateParameter are The Direction –…
Will I need to do a join of 4 tables to fulfill this SQL query or is there a simpler method?
I currently need to do the following: Find the names of all course and the students enrolled on them which take place on a Friday afternoon and have at least 2 students enrolled on it. I am thinking what I should do is Join the tables titled student, takes, course, section and time_slot together and from ther…
Stuck to select maximum row
I have a table with columns: I need to select row with maximum value, and show info like I tried using group function MAX(), but I can’t select fullname, because if I use it as a GROUP BY expression, it will select max in groups. Other way, is to use WITH statement, order table by value desc, use functi…
Error – Select statements included within a function cannot return data to a client
I am trying to create a function that will query times in a table and then return the correct time based on the site. The times in the table being queried have the opening and closing times of the branch. I am not sure if I should be using CASE or IF. When I use CASE, I get this error:
Columns ID, update, project. I want a pie chart where there are percentages of updates of different projects in database for particular employee
I have used this query but it gives me percentage of only single project. Answer It is a little unclear what you want. If you want the proportion within a project: If you want the proportion over all projects:
How to fetch all values of a column based on value of another column in same table?
I got the following structure: How to fetch all values by taking the $_SESSION[‘admin’][‘id’], finding the country_id of that admin and getting all other admin_id and country_id that are the same of the session admin? So, lets say the currently logged in admin has id = 5 , that means t…
Apache Phoenix SQL Join Limitation when using sub-queries
I have this query in Apache Phoenix SQL: select WO.* from ( select “nr_id”, “txt_commrcial_label” from “e_application” APP …
Making a pivot table group by users
I want to see user statics, so I made query: It’s working. Here is the result: But I want to make a pivot by Months (last 6 months)… Table: obj_odb_l l ->date column -> l.datum_p -> trunc(l.datum_p,’MONTH’) How can I make a pivot table ? Answer Consider adding the month expres…
Issues with Dapper query syntax
little assistance here with my query using dapper, been getting error Message = “ORA-00936: missing expressionn” on my query. I would like to know what am I missing here? Answer Firstly with Oracle queries you need to use : instead of @ to denote a parameter placeholder. Then secondly this code: w…