I am interested in knowing if there is an efficient way to record the analytics from a SQL query while still providing the records to the requester? I’m currently on MS SQL Server 2012. Let’s say for …
Tag: sql
SQL – Finding foreign key ID associated with a combination of multiple/variable table variable rows
In a Microsoft SQL Server stored procedure, I have table variable, @PlayerComboStrategy, with a variable number of rows, and columns PLAYER_ID, POSITION_CODE, STATUS_CODE. I am looking for the most …
SQL Query to get the compliance status
I’m trying to get the following query constructed I got a table called client_vendor as follows. This stores the details of answers provided by client against a vendor for 4 questions. client_vendor …
Is there a way to substitute GROUP BY
I have two tables i’m working with: comporder(quantity,cod(Fk on cod(product),cod_ship); product(cod(Pk),price); I need to produce a query that will give me the sum of the prices of the products that …
MYSQL SUM(IF) with group by NAME but some NAME wanna makes sum
I have one question in SQL. This is the query. it makes a result below: but I wanna make Customer A and B sum together as A(not B) or new name(e.g. Z) like this: I want to modify the query and output it. Answer I understand that you want to group together customers A and B. You can do this
Get all parent rows and each row followed by their child’s rows
I’ve two tables one of them called Main-Level another one called Sub-level Sub-level has a foreign key from the Main level (the relation between them Main-Level has one or Many Sub-levels ) what I …
How to Pivot row (Dates of the month ) into columns in sql ? ( without giving the date of the month “for in” )
I have a data table which data as below & every prod_id have an amount daily for the month of Feb. I need to get the output as below Please help ,getting the error of missing right parenthesis FOR DATE IN (DATE) without giving the date of the month (specific as FOR DATE IN (’01-FEB-20′,……
Comparing two dates in Oracle after using TO_DATE function
I have the following Oracle Query that is converting todays date and the date field from the table into the same format. However, when trying to compare the two they aren’t coming up as equal. The cast is used on the field in my table, both these return. However, when adding the following where statemen…
How to assign random session key to visitor who visit the website in PHP?
I have not much experience in PHP. i am creating a shopping store in PHP where a visitor can add item into cart without creating account (as guest). so i just want to assign him a unique id or key for add to cart process. so how can i assign him a random key when he visit the website? Answer
Concate string into temp table in cursor
I have a temp table structure @temp2 like this and would like to add the driverID column with a result like 5555, 68989 to do this, I use the cursor to loop another table look like this Here is the code sadly, I got the driverID column is null and would like to have finalized temp table look like this: