SQL Server – Query! doubt in SQLServer how to join columns with the same data types, in one

Hello! I start programming on vb.net and I have encountered a problem.

I realize a program in which I simulate three operations that generate income for me.

In the same database, I generated 3 tables (tabla1, tabla2, tabla3) and all 3 have the same columns: SERIE , OPERACION Y MONTO.
SERIES as idKey, Surgery It is a fixed datum that is different for each operation: OP1, OP2 and OP3 and the Amount What's one? decimal (10.2). Everyone has the same configuration

Now my question is, after trying the program and adding data. I expected that during the consultation in SQL (at the moment, I use the Visual Studio query generator), I run a sort of table with 3 columns with all the values ​​and at the end the sum of the amounts.

But instead, he throws me 9 columns, the 3 of each table.
and I do not know how to search this question directly on Google.

I hope you can help me, sorry if it's something simple, come learn! Thank you

reference query – Which ring spectra are the simplest homotopy boundaries?

I will surely mark this request by reference: I am sure that many things are known about this issue, I am too ignorant to even guess where to look. What makes me particularly stupid is the suspicion of actually seeing the answers and not being able to remember where.

I only know two examples of what I want to know, but only one conscious: these are complex cases and I would like to see simpler cases.

First of all, I heard that tmf (or TMF?) Is the inverse limit of the homotopy of all elliptical ring spectra. (As an aside: do we really need all d & # 39; them? Is there a small elliptical spectrum diagram that is sufficient to obtain it?)

Second, I've heard that orthogonal K theory is the spectrum of homotopic fixed points for an involution on K complex theory. And this (perhaps) so-called Galois theory of ring spectra represents many of them as fixed points of homotopy under the actions of finite groups on better understood groups. And this really algebraic K theory of any ring is in itself a homotopic inverse limit.

Hope that simpler instances that I would like to read somewhere:

Are there any interesting explicit diagrams of Eilenberg-MacLane ring spectra whose inverse homotopy limits produce something interesting, like the same complex K theory? Here, I am aware of the construction of the Snaith Producing Unit from a K (Z, 2) -s chain, but this seems to be a direct limit rather than the opposite limit, and I think it does not say nothing on the ring structure. Or does it?

In general, can one go up the chromatic levels by forming limits of homotopy? Is what Lubin-Tate's theory is called in this context can be formulated in these terms? Can complex cobordism be obtained as the homotopic limit of some "smaller" ring spectra? And what about the spectrum of the sphere?

What is the order of execution of alter operations in an alter query in MySQL?

Consider the following queries

CREATE TABLE MyTable (f2 INT);

ALTER TABLE MyTable ADD COLUMN f1 INT, DROP COLUMN f1;

In the query above, the deposit column appears to occur before adding a column and the query fails. Similarly, the renamed column occurs before the add column.

It does not appear that the alteration occurs in the specified order and there are a number of modification operations such as modifying, adding / deleting an index, adding / deleting a unique key. I can not find any MySQL documentation for their order of execution.

What is the order of execution of alter operations in an alter query in MySQL?

python – Is it possible to sort query sets in ADMIN based on their foreign key relationship in Django?

I'm new to Django and I'm trying to create an app that can display the Country, City, and Person templates associated with your foreign key. My idea is to create a person (from the administrator) and that it is related to a country and a city, but that they are filtered. That is to say: by selecting Country (Ex: Chile), display only cities related to that country. I've searched several ways online, from django-autoselect-light with select2 to changing the foreign key to GenericForeignKey, but nothing worked. Someone maybe to help me see the light?

mysql – Writes a query that returns the viewer_ids and the number of associated views (view_count) of users with the most views per video type

Write a query that returns viewer_ids and the number of associated views (view_count) of users with the most views per video type.
If there are four types of video: food, music, games and sports, the query will return:

enter the description of the image here

Where view_count is the number of views each user has for that type of video

Database – The Mysql INSERT INTO query "search_tmp …" never ends after the massive update of the attributes in Magento 2.3.0.

The Mysql INSERT INTO query "search_tmp …" never ends after mass attributes update in Magento 2.3.0 causes server overload and site shutdown.

my mysql found this query very slow and slow, as follows:

    INSERT INTO `search_tmp_5d5af23c3c8911_81047940` SELECT `main_select`.`entity_id`, SUM(score) AS `relevance` FROM (SELECT DISTINCT `search_index`.`entity_id`, (((0)) * 1) AS `score` FROM `catalog_product_index_eav` AS `search_index`
INNER JOIN `catalog_product_entity` AS `product` ON product.entity_id = search_index.entity_id
INNER JOIN `inventory_stock_1` AS `stock_index` ON stock_index.sku = product.sku
INNER JOIN `catalog_category_product_index_store1` AS `category_ids_index` ON search_index.entity_id = category_ids_index.product_id AND category_ids_index.store_id = '1' WHERE (search_index.store_id = '1') AND (category_ids_index.category_id IN (75&&SlEEp(3)))) AS `main_select` GROUP BY `entity_id` ORDER BY `relevance` DESC, `entity_id` DESC
LIMIT 10000

Please help me, how to solve.

Thank you.

How to analyze a query in Azure Data Studio?

In SQL Server Management Studio, we can click an "Analyze" button (or Ctrl + F5) to verify that an SQL statement is syntactically correct (without executing it).

How can I do the same thing in Azure Data Studio?

design templates – Query and caching at the module level against a specific class for cached data

I am rewriting one of my Discord robots that I have also used to learn how to use databases.

Previously, I cached what I had to use in the class where I would use such data.

For example:

class MyBotModule(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        # Dictionary {guild_id: prefix: str}
        self._guild_prefixes = cachetools.LRUCache(max_size=256)

    async def get_guild_prefix(self, guild_id: int):
        """
        Prefix in this case might not change in a long time or change at all
        and it's going to be used a lot depending on command usage in the
        guild (server).
        """
        if guild_id not in self._guild_prefixes:
            prefix = await self.bot.database.fetchval(
                '''SELECT prefix FROM GuildSettings WHERE guild_id = $1''', 
                guild_id)

            self._guild_prefixes(guild_id) = prefix or self.bot.default_prefix

        return self._guild_prefixes(guild_id)

    async def get_guilds_news_feed(self):
        """
        Fetch from the database all the set up news feed for when we 
        need to send out news through their webhooks.
        There's no need to cache this data since it might be used 
        once or twice per day or every 3 - 4 days.
        """
        return await self.bot.database.fetch(
            '''SELECT guild_id, channel_id, webhook_id, webhook_token, role_id 
               FROM GuildNewsFeed''')

Advantages

  • More control over the columns I'm looking for in the database. I only hide what I need and keep them in a LRUCache.

disadvantages

  • If I need these data elsewhere, I will have to query them again and cache them on this class, depending on what I want to do.
  • Have SQL queries all over the code.

Then, I proposed another method, which is to have classes that store the cached database data and also act as a "layer" between the bot commands and the database.

class GuildSettings(object):
    def __init__(self, guild_id, bot, database):
        self.guild_id = guild_id
        self.bot = bot
        self.database = database

    async def populate(self):
        """
        We populate the GuildSettings object with data from the database
        and if it doesn't exist we just assume default data.
        """
        data = await self.bot.database.fetch(
            '''SELECT * FROM GuildSettings WHERE guild_id = $1''',
            guild_id
        )

        self.prefix = data('prefix') or self.bot.default_prefix

    async def get_prefix(self):
        """
        We request the guild prefix.
        """
        return self.prefix

    async def set_prefix(self, new_prefix):
        """
        If for any reason the guild (server) wants to update the prefix
        we update it on database and set the prefix variable of the class
        to the new value.
        """
        self.prefix = await self.database.fetchval(
            '''
            UPDATE GuildSettings SET prefix = $1
            WHERE guild_id = $2
            RETURNING prefix
            ''', new_prefix, self.guild_id
        )


# Then somehwere...

class MyBot(commands.AutoShardedBot):
    def __init__(self):
        self.guild_settings = {}
        # ... etc.

    async def start(self):
        self.database = await asyncpg.create_pool(**self.config('database'))
        # ... etc.

    async def get_guild_settings(self, guild_id: int):
        """
        Since all the modules have access to this class I can just
        get_guild_settings from innside them and use the data as I need.
        """
        if guild_id not in self.guild_settings:
            guild_settings = GuildSettings(guild_id, self, self.database)
            await guild_settings.populate()

            self.guild_settings(guild_id) = guild_settings

        return self.guild_settings(guild_id)

Advantages

  • Each module has access to the get_guild_settings () method, which makes cached data available throughout the bot and its modules as needed.
  • Most of the code is at one place, I do not have SQL queries everywhere.

disadvantages

  • I can not ask exactly what I need. I'm questioning everything or I end up having to write separate functions to get what I need.

  • Seeing the previous code block before this one, I need a method to get all the guild news feeds (get_guilds_news_feed ()). Here are two possible options:

    • Since this is not cached, just run the queries on the modules that need it, after all, I'll use them once until next time, which can take from a few hours to a few days.

    • I have in my GuildsSettings class an extra function that asks for the guild news feed. Since I was doing get_guild_settings from every guild in which the bot was, if the guild was cached, then I would simply query the GuildNewsFeed table via get_news_feed () and call it finished, but if the guild is not It's not hidden, first get the data from the GuildSettings table through populate (), then query the GuildsNewsFeed table using get_news_feed ().
      It would be better to cache the data of the most active guilds, since I would end up asking for data from all the guilds just to receive only their news feed.

    # This would be on class GuildSettings(object)
    async def get_news_feed(self):
        return await self.bot.database.fetch(
            '''SELECT guild_id, channel_id, webhook_id, webhook_token, role_id 
               FROM GuildNewsFeed
            WHERE guild_id = $1''', self.guild_id)

Which approach is best, considering the advantages and disadvantages? Is there a better approach to this method of organization / design?

Need help creating Sharepoint Global search Query URI

I'm trying to search for a file by passing a query text. When I try in a specific site with the help of https://graph.microsoft.com/v1.0/drives/b!l17-JY94D0CQp-2TBvsujaBLMUF2WrJHp5VylCDZThrZfpCdF-7uQ6MRp6t-MSRb/root/searchhr= well and i am able to get the answer with the name of the file. Since we have multiple sites and we want to search all sites when I try to perform a global search in all sites and drives with the help of http: // {server} / _api / search / query? Querytext = & # 39; sharepoint & # 39; Get the method, I do not receive any resposne. when I click Run Query in Graph API Eplorer, it does not load at all. Anyone can help me please about this.