Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
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
 Peter_Cammaert
		
			Peter_Cammaert
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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...
 
					
				
		
my short answer: just type 1 into a new expression
 maxgro
		
			maxgro
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		if I understand, in the load script
load
field,
....
1 as newfield,
....
from
.....
but why you don't want count?
 
					
				
		
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.
 simospa
		
			simospa
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Another short answer 🙂
LOAD field1
field2,
...,
fieldn,
1 as myCounter
FROM ...
S.
 MayilVahanan
		
			MayilVahanan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
Try like this
Load *, 1 As DataCounter
from sourcetable;
 
					
				
		
Load *, 1 as DataCounter from Table1;
 
					
				
		
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
 Peter_Cammaert
		
			Peter_Cammaert
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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...
