Let’s say I have a table called t in Postgres: id | group_name | state —————————– 1 | group1 | 0 2 | group1 | 0 3 | group1 | 0 I need to …
Tag: sql
“Action AppHttpControllersCommentRepliesController@createReply not defined” error on Laravel
I am trying to add an option to reply to comments on a post, but I keep getting that: CommentRepliesController@createReply is not defined. Adding a reply to a post through PostCommentsController@…
Conversion failed when converting the “invalid” value ‘Residential’ to data type int
How do I convert data that is given from result set string. I am trying to show the drop down box gui as a text but give it a value of 1 and 2 what I want it to show as for drop down choice is right: …
Making a custom table from one table
My table is called Storage_Tot which has date, tagid, value components. Below are the two tables (Table A and Table B) I created using SQL query. I essentially ran same query with different tagid …
Oracle update and change few columns records in two tables with a single query
I have two tables with names of Locations and Countries in My Oracle database. Locations table has columns with names location_id(fk), street_address, state_province, and country_id. Countries table …
How to combine monthly results into a single row?
If have a sales table with data like: SALES —– seller_id month amount 1 1 10 1 2 15 I would like to retrieve all seller’s sales in a single row. How can I combine the …
SQL statement: how can I pick a value only once from a table to update another table?
I wish to update table1 with any distinct value of table2 matching the same code, no matter which one or the order (value from table2 can’t be picked more than once) +——————-+ +——…
Entity Framework Core 2.1 trouble with relationships
I’m trying to convert the following sql query to entity framework but running into problems with what appears columns not joining to tables. SELECT a.TABLE_NAME AS tableName, b.COLUMN_NAME AS …
Sort Records comparing sums across multiple tables
In SQL Server, I am wanting to bring back all jobs where To make it easy to see what results I should get I added the following table and updated the inserts into tables. InvoicedRecieved is ignored for simplicity. Jobs 2,4 Should be returned. I also need another statement bring back the number of jobs per user that met the
Daily snapshot table using cte loop
I need daily snapshot of how many employees are employed on any given day (defined as @date between Start_Date & End_Date), with one line per date. At one point, the below script would return all …