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 …
Tag: sql
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
How to query the distribution (grouped by value range) of a column value in Oracle?
Suppose there is a table called DISTANCES in Oracle with a float type column named distance. The range of distance is from [0, 1000]. I want to know the distribution of the distances, for example, how …
Oracle SQL Groupby and SUM
I have the following query that groups every tender id and description and shows its total Sum: 3020 American Express 20 1000 Cash – primary currency 9903.25 3120 House Card …
java.sql.SQLException: Field ‘id’ doesn’t have a default value
I am trying to insert data into arrivaltimes tables but I am getting the following error: java.sql.SQLException: Field ‘id’ doesn’t have a default value Answer You are missing AUTO INCREMENT for Primary Key in arrivaltimes table. Just need to add AUTO_INCREMENT while creating table
Can’t retrieve data from SqlDataReader in C#
I need to insert values into several tables first I have to retrieve university id from table college and then insert faculty name into table faculty and get generated by SQL Server ID. After all of this I have to insert both ids into an other table. Problem is that I have to close readers and after I do it