I have a list of dates, and I am trying to find the number of expired / nearly expired and OK dates and build a new table showing these. The easiest method for me is to simply, query my database …
Building a trending algorithm based on post count and frequency
Say I have a Board model. Boards have many Posts. I simply want to find the boards that have the highest post count within the span of (x) days. Below is my extremely naive approach to this. With the …
SQL query missing select statement fetching data error
I am using SQL query fetching some issue data is not fetching black show. I am sharing this query here. Please help me. SQL query here select * from products where hitproduct=’0′ ORDER BY id DESC …
How to use MIN() by date in a clause that uses SUM() for another date?
I need to find all the clients that have their first order in 2017 and sum up their incomes in 2018. I have issue trying to do that in SQL clause. In my table I have 3 clients, 2 of them first …
Fetch data from one table columns whose names are value of another table
I need to fetch columns from a master table and the list of columns that i need to get will be in a metadata table for different users.This would need to be dynamic as each user might not have the …
Get today and yesterday data from mysql
SELECT * FROM att_record2 WHERE DATE(row_datentime)=DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND out_datentime=”0000-00-00 00:00:00″ AND in_datentime!=”0000-00-00 00:00:00″ I want to get data from …
Problem with deleting items from pivot table
I am building project for learning purposes in oop php where I create properties/ads, and I have three tables, properties, photos and property_photo. My goal is when I click on delete button to delete …
Data type mismatch in criteria expression. whats wrong?
how do I put an int variable in sql? int x = Convert.ToInt32(Session[“id”]); string MySQL = @”UPDATE users SET email = ‘”+Request.Form[“email”]+”‘, pname = ‘”+Request.Form[“pname”]+”‘, …
Extracting values from XML column in Oracle
I have some data in an Oracle table which is stored in an XML-format string (column response in table WS_LOG). I would like to extract data from each different node below
Adding a row number respecting the order of each row
I have a table like this id, period, tag 1 1 A 1 2 A 1 3 B 1 4 A 1 5 A 1 6 A 2 1 A 2 2 B 2 3 B 2 4 B 2 5 …