CONCAT multiple columns in HP Vertica
Hi,
someone please help me
How to concat multiple columns in Vertica
I have tried to execute ..
select ifnull(A1.name,'')|| ifnull(A1.exp_month,'')|| ifnull(A1.exp_year,'')|| ifnull(B1.firstname,''), ifnull(B1.lastname,'')|| ifnull(B1.address_1,'')|| ifnull(B1.address_2,'')||''
from .....
I'm getting an error
[Vertica][VJDBC](3681) ERROR: Invalid input syntax for integer: ""
someone please help me
How to concat multiple columns in Vertica
I have tried to execute ..
select ifnull(A1.name,'')|| ifnull(A1.exp_month,'')|| ifnull(A1.exp_year,'')|| ifnull(B1.firstname,''), ifnull(B1.lastname,'')|| ifnull(B1.address_1,'')|| ifnull(B1.address_2,'')||''
from .....
I'm getting an error
[Vertica][VJDBC](3681) ERROR: Invalid input syntax for integer: ""
0
Comments
dbadmin=> select ifnull(1,'')||ifnull('abc','');
ERROR 3681: Invalid input syntax for integer: ""
select ifnull(1::varchar,'')||ifnull('abc','');
?column?
----------
1abc
(1 row)
not yet cmplt my part
select count( distinct ifnull(1::varchar,'')||ifnull('abc',''), clm1,clm2 )
ERROR:Function count(varchar, varchar, varchar) does not exist,
Thnx in advance
You cannot use a count function on more then one columns at once. but you can do a count(*)
You are trying to use count function on 3 columns ( 1 concatenated , 2 clm1 3 clm2)
Do you want to concatentate clm1 and clm2 as well with 1st column and then count distinct
If so then you can do like this Hope this helps
yeah ..now it is working fine.
plz join here https://www.facebook.com/groups/Vertica.Tableau/
//You cannot use a count function on more then one columns at once. but you can do a count(*)
But MySQL is supporting.
i'm converting MySQL code to vertica ..
is there similar kind of soundex() function in Vertica?
the function in WHERE class...
where
case when soundex(t1.name) <> soundex(trim(t2.fname)||' '||trim(t2.lname)) .....
I don't want to create/import Library kind of stuff
could you plz suggest any easiest alternative way ?
And
LOCATE(' ', name) function in Vertica?
select email,right(email, length(email) - locate('@',email)) from customer
I/P:
abcd@gmail.com
bcde123@yahoo.com
bcde
o/p:
gmail.com
yahoo.com
bcde
i'm converting the code to Vertica:
select email,split_part(email,'@',2) from customer
I/P:
abcd@gmail.com
bcde123@yahoo.com
bcde
o/p:
gmail.com
yahoo.com
for 3rd i/p i'm getting no value so my query is not working
any alternative?? thnx in advance
Three ways you can achieve this
I have a table like this. 1. Using CASE statement and REGEXP_COUNT function. 2. Using POSITION function similar to your MySQL statement 3. Using INSTRB function , same as your MySQL statement For Soundex Functionality:
You can find a good UDF here.
http://vertica-forums.com/viewtopic.php?f=80&t=1492
Hope this helps
For Soundex Functionality .. I couldn't understand these steps
there are mainly 2 steps to do it.
I'm running code in [Remote desktop machine] DB Visualizer ... tell me where I have to place source code and where i have to compile compiling cmds
Thanks in advance
There are three steps in the solution on forums
1. Compiling
2. Example
3. Source
For 1st and 3rd step , we need to do it on Vertica server/cluster with dbadmin user.
Steps.
1. In Source part of the solution copy the complete code and put it into Soundex.cpp file (create this file first )
2. Compile the .cpp file with the command in the compile part of solution, this will create a .so file which will be Soundex.so file
3. This file is used by Vertica to install a UDF.
4. Use the Example part of solution to install the Function
a. Create library with path of .so file
b. Create function with parameters .
This is how you can install this UDF.
For using it , you can use it from DBvisualiser
Hope this helps.
MySQL: select SUBSTRING_INDEX('192.128.0.15','.',3 ) o/p: 192.128.0
same functionality in Vertica.??
I want to run my query for all cases like ip values 1.123.0.15 [ o/p: 1.123.0 ]
thanks
Hope this helps !
It doesn't work for all cases
ex: select SUBSTR('2.128.01.153',0,10);
------------------
o/p: 2.128.01.
I found the solution
SELECT SPLIT_PART('2.128.01.153','.',1)||'.'||SPLIT_PART('2.128.01.153','.',2)||'.'||SPLIT_PART('2.128.01.153','.',3);
------------
o/p: 2.128.01
You can do it this way too.
Suppose I have a table like this Using REGEXP_SUBSTR Function
nnani=> SELECT IP_ADDR,REGEXP_SUBSTR(IP_ADDR,'\d+[.]\d+[.]\d+',1) as NEW_IP_ADDR FROM NAVIN.IP_TEST;
IP_ADDR | NEW_IP_ADDR
--------------+-------------
2.128.01.153 | 2.128.01
192.128.0.15 | 192.128.0
1.123.0.15 | 1.123.0
(3 rows)
REGEXP Functions are very powerful functions in vertica, they prove to be handy many times.
Hope this helps
It is working fine.
could you please share your mail id?
or else plz drop me a text mail to princeuday9@gmail.com
I want to discuss some other imp things plz send me mail
Thank you