
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how to create a new column filled with '1'
Hi all,
my short question:
how can i create a new column filled with '1' in every row in an existing table.
I need it to count my data without the 'count' command.
best regards
Philipp
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or if your table already exists (and you don't wanna change the LOAD statement - or you can't), use this:
JOIN (ExistingTable)
LOAD 1 AS RowCounter
AUTOGENERATE 1;
We should test which is faster: another LOAD RESIDENT or a simple JOIN. Massimo's original table LOAD moditifcation will beat everything else...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my short answer: just type 1 into a new expression

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if I understand, in the load script
load
field,
....
1 as newfield,
....
from
.....
but why you don't want count?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry but i don't understand your idea... i need a column named 'DataCounter' that have as much as rows like the other columns in this table. But 'DataCounter' has a '1' in every row.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another short answer 🙂
LOAD field1
field2,
...,
fieldn,
1 as myCounter
FROM ...
S.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Try like this
Load *, 1 As DataCounter
from sourcetable;
Please close the thread by marking correct answer & give likes if you like the post.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Load *, 1 as DataCounter from Table1;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is why the long more detailed question is more helpful
You talk about a new column which sounds like a new expression in a chart, creating a new expression with just '1' in it will do just that in a chart.
Actually though it sounds like you a looking for a new field in your data model, now you have given a bit more detail.
For that you can simply add a new field to your load
1 As DataCounter
hope that helps
Joe

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or if your table already exists (and you don't wanna change the LOAD statement - or you can't), use this:
JOIN (ExistingTable)
LOAD 1 AS RowCounter
AUTOGENERATE 1;
We should test which is faster: another LOAD RESIDENT or a simple JOIN. Massimo's original table LOAD moditifcation will beat everything else...
