I am trying to create some tables within a database, however the tables are not appearing in my object explorer view. my code is as follows: I looked this up before posting and found this exact question: Creating table with T-SQL – can’t see created tables in Object explorer However, he was using …
Oracle Sql: How to add multi sub total in sql?
I want query multi sub total in query sql. How query multi sub total. please help me. SQL CODE: Result Query: But i want add multi sub total in query. I want Result Query: How add multi row sub total? Help me please. Thanks in advance. 😉 Answer I will post a solution with using the group by rollup extension.…
T-SQL Dollar Sign In Expressions
In this answer, there is a trick which allows to use the ROW_NUMBER() windowed function with a ‘constant’ in the ORDER BY clause: After some search in Google, I can’t find what dollar sign means in this context? I’ve tried to execute a simple query: And it returns 0. Could somebody exp…
SQL: error when creating a foreign table that has an enum column
I’m creating a foreign table (foo_table) in database_a. foo_table lives in database_b. foo_table has an enum (bar_type) as one of its columns. Because this enum is in database_b, the creation of the foreign table fails in database_a. database_a doesn’t understand the column type. Running the follo…
How to summarize a query separating with commas
I have a list of dates with folios, one folio can have multiple dates. The folio is the employee holiday request folio. (SQL Server 2008) Instead of showing that info like a list I need to show it in the following format: Here is the SQL Fiddle: http://sqlfiddle.com/#!3/0ddd2/7 Answer Larry’s answer is …
How to cross join a table and use fields from the select statment in the where clause of the cross join
Unfortunately I cannot make this a procedure in this case. I’m setting the variables in the select statement and using them in my cross join. My Count(*) as Line Item is 0… What am I doing wrong? Answer
Unioning overlapping time ranges, then summing the total time
I have a hardware group and many devices into this group. Example: All devices are monitored using ping. When some device is not working the program add a row into a table saying the start of break. When the device back on then the program update this row saying the end of break. It’s ok to know the tot…
MySQL error 1093. how to delete from this
Select worked: delete doesn’t work: Error Code: 1093. You can’t specify target table ‘pre_log’ for update in FROM clause 0,001 sec Answer You have specified pre_log table in your sub query from which you actually Delete the records try this might help you..
Is there a way to have a placeholder when select returns no rows?
I have a table, report_total, that contains calculated values for some of the total_types_cd (codes) but not necessarily all of them. If there is no corresponding row, I’d like to have a …
Catch SQL RaiseError in jsp
I am developing a database and some JSP Pages to perform CRUD operations on it. I cannot catch exceptions related to my SQL Code in my JSP Code. For Example: I have this part of code where I raise an error in T-SQL: I need to call the function where I raise those errors in JSP code. Heres a part