I need to run below code on different environments and it works fine when table1 exists but when it does not exist then it throws error in cursor declaration that “table or view does not exist”. I am …
Trying to join multiple tables in mysql – get error 1054, Unknown Column
I want to join multiple tables using JOINs, and mysql/mariadb is refusing to find one column. The column exists, of course, and I can’t figure out what the cause might be. Table Layout CREATE TABLE …
Getting the result of sum / count with two different conditions
I’ve been trying to extract to average times (based on some criteria). I need to get two results. These two results are based on how many minutes between two times, divided by the quantity of …
mySQL – Check Table for duplicates efficiently
I have a table “people” where (for simplicity) everyone has an ID, this ID is not unique so two entries can have the same ID. I now want to find all duplicates which I would do like this: SELECT p1….
SQL server – How to split one column into more columns?
I have this query: select plantnaam, plantmaat, stapel, hoeveelheid from kist where rij = ’11’ order by stapel ASC, datum DESC . What I want to achieve is to give each number of the column ‘Stapel’ a …
Change the format of joining date to month-day,year sql
Change the format of joining date to month-day,year for e.g. January 31,1992. Query Error Table emp_demo format Answer You seem to be looking to display your date in a given format (which is what to_char() does in Oracle). In SQL Server, you can use format(): Demo on DB Fiddle: Yields:
Is there a way to obtain linked server query information?
I’m trying to query information on a linked server. The code works fine when run on the machine but doesn’t when connected via a linked server: The error I get is: Purpose behind it is to keep a track of queries run across an estate of servers into 1 central so we can monitor impacts (basically bu…
Conversion failed when converting date and/or time from character string. Sql
I want to display data between the said date range but it is showing the conversion error. What could be he problem? Answer Try using the standard form for dates: Actually, the above uses ISO standard formats for dates, which almost always (but not always depending on internationalization settings) work in SQ…
Remove duplicate values from string in oracle
I have requirement where I have input data like Output Required: Solution Tried: Output of the query: Can someone help here in removing repeating alphabets. Thanks Answer You can use a subquery:
Not in aggregate function or group by clause: org.hsqldb.Expression@59bcb2b6 in statement
I’m trying to group SUM(OrderDetails.Quantity) but keep getting the error Not in aggregate function or group by clause: org.hsqldb.Expression@59bcb2b6 in statement but since I already have an GROUP BY part I don’t know what I’m missing SQL Statement: I’m trying to create a table that s…