Skip to content

MySql Group By Count item count Distinct

I have a table looks like Here user id 1 exist in level 1 and level 2 Now when we count group by level then in counting we want ignore user_id 1 from level 1 cause it exist another group. we want to consider only one group existing and higher group. I have done only group count but cant understand

Conditionally convert a decimal value to integer

It is showing a result like this But I want result like this when type is 1 then result should be in integer format: on else condition (@Type rather than 1) I want result like this I have tried this query Answer This will work for you. When @type is 1, the result will be 10 for both values. Otherwise

Filtering SQL results by date

Here is my query for a maintenance dates list. The idea is.. Everyday the server will email customers to let them know which checkdates are coming, based on the days notice that is set for that type of check. (see image) Currently it is showing all checkdates. All i need to do is filter the list so it only sh…

Storing unique images in table

I’ve inherited a database which contains .png images which have been converted byte[] and finally ToBase64String and saved in a table with many duplicate images. I want to clean this up create a new table with unique images but the original tables have no primary key related to the image. I’ve com…

Teradata – How to understand data distribution?

I’ve been looking everywhere how I can improve my Teradata views performance by choosing the right primary index in my tables. I have found multiple answers pointing to the same thing, by using this query to see how data is distributed through the AMPs : I get that I need to have an even distribution, b…

Populate listbox from access file

I have found a piece of code that enables me to list or populate listbox based on access database When trying that I encountered an error Type data mismatch in criteria expression at this line rst.Open strSQL, cnn, adOpenKeyset, adLockOptimistic, adCmdText Answer Your table got a field related to a secondary …

Create a table for following condition

condition for the problem to be solved: The code i tried to do is I couldn’t solve the first condition and so i am getting right parenthesis missing for final condition Answer I would translate your requirement as follows: Changes to your original code: you want NUMERIC rather than NUMBER ArCode must be…