I am making a call to a SQL stored procedure which is returning a small table of users and their bosses. What I would like to do is compare this information against a variable in a different part of …
Missing AddWithValue from DbCommand.Parameters
I am building an sqlwrapper to handle both MSsql and Sqlite, I have no issues using the generic dbconnection, dataset and dataadapter so far, but with dbcommand parameters.add is the only option. I’d like to use parameter.addwithvalue like sqlcommand and sqlitecommand have, but I am unsure how to implem…
How to format a Vertica date column into just the month?
I am trying to format a Vertica date column into only the month. I would need the final value in some sort of date datatype so in the report I can order the results by date/time, not order by text. …
Extrapolate running total from .LAST value of a BY GROUP
I trying to figure out how to create a running total, if all we have is the total sum in the .LAST variable. I created a sample dataset that should make it a little clearer what I am after: ; so, as you can see we only have data for the last time the store was in business, which includes
How to find table name using primary key name in sql?
I have names of primary keys in a variable and I need to find the table to which they belong. The db has many table so linear search is not an option.
How to automatically subtract or add data from columns in mysql
I am building a system for doctors and patients where the patients submit the type of the medical examination and the quantity of medicine they use. I want to be able to subtract the value of the …
Product() aggregate function
While explaining some concepts over CTE, was asked with a cute question.. can we find the multiplication of rows , while we always concentrate on the SUM() from a fresher. That gave me a thought! Is it ever possible with just an SQL. I was also considering the maximum number precision we can even support, sin…
Is it OK to swallow an exception for DB INSERT
Is it OK to swallow Duplicate key violation exceptions for INSERTS or should you check if the record exists? So let’s say that I have a table Photo with one field: PhotoName. I’m looking through a file directory to add items to Photo. In the process, it’s possible that when I find a photonam…
Optimization of BigQuery aggregated data between two dates
I’m trying to compare the result of one query (example: number of rows), between the beginning of the current month and the current date, compared to what happened the previous month. Example: Today is 25/01, so I’d like to know the number of rows created between the 01/01 and 25/01, vs the previo…
Select info from a table referencing info from another table
I have a main product table with different products. Different products have different specs, so I’ve created separate specs tables for each product (there will be more than ten of them). What I want to do is to show individual product’s specs on a product_page.php whenever the product is clicked.…