How To Use SQL Temp Tables In Tableau

How To Use SQL Temp Tables In Tableau

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI

Оглавление (1 сегментов)

Segment 1 (00:00 - 03:00)

so you may be working inside of tableau and you're trying to do a temp table or insert some kind of so that you can reference it later whether it's going to be in a joint or something like that and tablet just doesn't support it so i'm going to go ahead and hit this and you're going to get an error it's going to be a syntax error and you're just trying to figure out how to do this i'm going to show you how to solve that in this particular tutorial so right here what we have is i'm creating a temporary table that i want to be able to use so that i can reference it later down here in my left join and that's just because i'm going to be doing a little max function right here so i need to pre-aggregate it but i do need the a certain number from off of there an id in order to be able to join it on so you won't be able to do that inside of an inner join or anything like that right here to accomplish what i want to do so again creating a temp table was the best way to do it and so that tim table is going to be called look up and we'll look at this in sql so it's a lot easier to follow but when you go to try to do it tableau gives you an error saying hey i can't do it so you say okay well maybe i can't create a temp table in tableau which you cannot do but then when you go here it's going to try to reference that table and that table might not be found now i have that table already loaded on the server so it's not a problem what i want to do is show you how to actually access this and let's take a look at the sql query real quick so we can see exactly how that was built so here we are in sql and we have the same exact query that we had inside of tableau where we have this create table we're going to insert in we just want this id number and this region number right here a little bit of logic that we put in there and then we want to later use this table inside of this bigger query that we have down here and so when we run this inside of sql this works out perfectly so if i try to go ahead and run this without it so let's go ahead and let's hit ctrl right we run it we see okay there is no table call lookup and again that pound is just for a temporary table so it's not finding this particular table so let's run our create table first so it's created and it's added all the data from that query in there and then let's move this down a little bit and then let's highlight our select statement down here now when we run it we're going to get our data back so now everything is working the way we want it to work but we need to get this to be able to execute and tap load every single time it opens and so in order to do that you're actually going to go right here to this little button right here you're going to go to initial sql and here is where you actually want to put that create table so let me bring that in and write that in here so this is where you want to put just the first portion of that where you're actually going to be creating that temp table and you want to put that inside your initial sql and you're going to hit ok and so what tablet is going to do is as soon as tablet loads this particular data source and someone goes and reaches for this view it's going to execute that create table in memory and then hold it there for you and then for the actual custom sql which you can just drag from right there let's go right here and edit custom sql and we're going to get rid of that and now bring it in here and now we're going to be able to execute that entire query because it's going to create that temp table and then allow us to execute it right here and so that is how you want to go about um executing a temp table i don't believe it supports common table expressions but we'll have to test that out in another training but you can see we can get all of our data right back in one view by using that custom table so that is how you get around having to use temp or how do you use temp tables inside of tableau you

Другие видео автора — Data Analytics

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник