I’ve this table with the following data: ID Quantity Status 1 250 OK 2 440 HOLD 3 180 HOLD 4 860 OK Based on the value in the Quantity column for each row, the row should be repeated again if Quantity is bigger than 200, but repeated
SQL GROUP BY and COUNT with multiple columns
I know I’m just making a simple error somewhere, but I can’t figure it out. I’m sure this is beyond easy. I have a table with user ids, names, and a profile. I’m trying to count the number of users with each profile, and group them by the profile. Below is a sample of fake data. This i…
MySQL keyword aliases
I would like to set up aliases for MySQL keywords for faster typing of repetitive (or any, really) queries. Example: -> becomes: How could I go about achieving the above? I have looked around but unfortunately, most searches point to column and table aliases and I did not see a mention in MySQL documentati…
Provide a list of subtypes from Main group with range numbers
I have a table named Items containing a list of items both at grouped level (G) and sub level (L). However I want to see only the sub level (L) data but with the respective Group Name attached to each sublevel. The Grouped item has a start and end number range. The numbers are not +1 for the sub level
Alter Table Auto Increment starting number criteria from another query or field
I have a database that stores all our distribution partner sales. Every week I get updated sales that I load into what I call tblImport. I then have some queries I run that parse out new sales lines to tblUpdate and tblNewAccounts. What I am struggling with is automating what I call the Bill To ID(BT_ID) fiel…
How to find records with over a set amount over a 5 year period
I’m trying to find contact_numbers in a financial table who have given over 5000 in any 5 year period since 01/01/2011. I’m going around in circles. This is what I have but it’s calculating everything from 2011. Any help would be great! Answer I think you want this structured as:
Convert html foreach loop data to webgrid using asp.net mvc
Below html table is filling using two loop condition, and same i want using two loop conditions to fill Webgrid I have tried to fill one field in web grid by using below code. when I am click debugging mode after code line complete on this line the following error is showing. Answer The exceptions you’v…
How to read XML repeated nodes in SQL Server
I am using the following code to read OrderId but it is showing only first DECLARE @InputXMLHandle int Declare @RequestXml xml = ‘ …
How to update some rows in database table while processing data from that same table?
I have to write an update statement to update bunch of values in database table. First a bit of an intro. Our client is from industry of transport and logistics. They provide a service of transport (…
MySQL sort by 4 fields date and time
I have a table where there are 2 date columns and 2 time columns (arrival date, arrival time, departure date, departure time) I want to combine the 2 date fields in one and then sort by date, arrival …