I have a table that details Platform and Model fields, but does not have a column that combines the two. For example, I need any row that shows the Platform column as XXX and the Model column as YYY to generate a new column called Router and input the value XXX YYY. I feel like im close but dont understand SQL that well . . .
The Table Transformer macro is based on the AlaSQL library and you may check the examples of different use cases, queries and syntaxes in our documentation here and here.
For your current case you may use the following structure:
SELECT
T1.'Platform',
T1.'Model',
FORMATWIKI(T1.'Platform' + "-" + T1.'Model') AS 'Router'
FROM T1
WHERE T1.'Platform' LIKE "B" AND T1.'Model' LIKE "456"
Seems that it is smth similar to your original request or at least gives you some hints how to move on.
Yes, this solves what I needed! For a future question though, how would I keep the remaining columns in my table currently and just add the new one to the end? Rather than limiting it to just selecting the two and creating the third?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The format
SELECT
T1.'Column 1', T1.'Column 2', T1.'Column 3', T1.'Column N'
FROM T1
equals
SELECT *
FROM T1
So, as I have only 2 columns in my source table and I want to show both of them, I can use not only this query
SELECT
T1.'Platform',
T1.'Model',
FORMATWIKI(T1.'Platform' + "-" + T1.'Model') AS 'Router'
FROM T1
WHERE T1.'Platform' LIKE "B" AND T1.'Model' LIKE "456"
but this query as well
SELECT *,
FORMATWIKI(T1.'Platform' + "-" + T1.'Model') AS 'Router'
FROM T1
WHERE T1.'Platform' LIKE "B" AND T1.'Model' LIKE "456"
If you need to show only specific columns or change the order of your columns, you may list them manually.
If you want to show all the source columns as they are, you may use *.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.