I have this query in my program, when I do some sorting with select count(*) field from the query, I dont know why, it very slow when running that query. The problem is when i do some ordering from posts_count, it run more slower than i do ordering with the other field. Here’s the query: select ‘t…
Tag: sql
How can I avoid “stringly typed” code in T-SQL?
Consider some code like I believe that the technical term for such poor code is “stringly typed”. The key issue in the above code is that decisions are being made based on a string output that the developer needs to type and consistently get correct. If anything goes wrong, the language will be in…
Can you insert a custom value in an Auto-incrementing field in MS Access
The column auto-increments. User wants to insert a row with a specific number (I’ve confirmed it doesn’t already exist in the column). In SQL Server I’d do a quick SET IDENTITY_INSERT ON and insert statement. Is there a way to this for Microsoft Access or are they just out of luck. Answer Ca…
mssql execution order guarantee when conversion in where clause
I have following scalar function Problem with that is, that o.aValue could not only have numeric values, so that the convertion can fail, if it is executet on other rows of idmv_value_basic, where attrName is not ‘OM’. For some unknown reason this morning, our MSSQL-Server changed the execution or…
SQL Query to fetch the customers registered in the DB without email address(CS can have phonenumber and email in the same field but duplicating)
I need help with writing this query please , in the Database – the customer is registered twice , one row with the email address in the VALUE field and the other row with phone number in the SAME VALUE field . I want to fetch customer who DO NOT HAVE email address in the VALUE FIELD . For example
difficulties with COUNT function
I am new to SQL and am having trouble using the count function to determine how many ‘YES’ or ‘NO’ for each criteria – apologies, this may be a stupid question. I have a table with data like this (there are more businesstravel categories): attrition businesstravel Yes Travel_Rare…
DISTINCT nor GROUP BY doesn’t work to return unique values
I need only latest updated location from each barcode but I can’t achieve that. Please help I am a newbie. Answer I think you can do that by using Row_number() like this:
SQL merge entries with start and end dates to entries with single dates
I have two tables, lets call them A and B. Table A has data regarding specific events and has a unique key column pairing of event_date and person. Table B has aggregate data over time and thus has key columns start_date,end_date and person. The date ranges in table B will never overlap for a given person so …
Take oldest record in a set of rows
So, I have this problem, I have this set of records in a table TemperatureID CastingID TemperatureDateTime TemperatureValue 1421294 1073513 2021-01-07 11:53:00.000 1648 1421295 1073513 2021-01-07 11:54:00.000 1698 1421326 1073514 2021-01-07 22:00:00.000 1594 1421327 1073514 2021-01-07 22:11:00.000 1609 and th…
How merge these two sql queries in mysql?
I want to merge below two queries and display two p_artist.id count based on the condition of each band name but I am not getting any clue. Can anyone help me, please? Thanks Answer I mean I want to have two-column of count ids The requirements are not clear at all and I had originally typed a separate answer…