drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjiv Kumar <sanjiv...@gmail.com>
Subject Re: Regarding Drill Select query
Date Tue, 17 Jan 2017 14:37:41 GMT
Hello Arina
                 Then what is the solution for that.? Is there any other
solution for that.??‚Äč

On Tue, Jan 17, 2017 at 7:11 PM, Sanjiv Kumar <sanjivktr@gmail.com> wrote:

> Hello Arina
>                  I have used same name as in my db table, but still name
> showing null..
>
> NOTE:- One more thing i have to mention if i group by all the table which
> are used in select query then the T3.Name is showing fine.
>
> SEE EXAMPLE:--
> SELECT (CAST(T2.`ID` AS BIGINT)) AS `No of Order`,T2.WebsiteID,T3.`Name`
> AS `Name`,count(*) over() FROM <pluginName>.<dbName>.<schemaName>.<tableName1>
> AS T2 INNER JOIN <pluginName>.<dbName>.<schemaName>.<tableName2>
AS T3 ON
> T3.`ID` = T2.`WebsiteID` Group By T2.ID, T2.WebsiteID,T3.`Name`;
>
> If i used above query (using group by with over()) then the result is
> showing fine.
>
> But my question is we can't predict which column have to group by at
> runtime (e.g:- through code).
>
> Is Group By Required with OVER() ??
>
> On Tue, Jan 17, 2017 at 6:12 PM, Sanjiv Kumar <sanjivktr@gmail.com> wrote:
>
>> Hello Arina
>>
>>               Thanks for reply. I have tried over() it working fine with
>> single table, but when i used join then the other table column showing null
>> value.
>>
>> See This Example:-
>>                             SELECT (CAST(T2.`ID` AS BIGINT)) AS `No of
>> Order`,T2.WebsiteID,count(*) over() FROM <pluginName>.<dbName>.<schemaName>.<tableName1>
>> AS T2;
>>
>> This Working fine.
>>
>> But If i used Join..
>>
>> See This Example:-
>>
>>                            SELECT (CAST(T2.`ID` AS BIGINT)) AS `No of
>> Order`,T2.WebsiteID,T3.`Name` AS `Name`,count(*) over() FROM
>> <pluginName>.<dbName>.<schemaName>.<tableName1> AS T2 INNER
JOIN
>> <pluginName>.<dbName>.<schemaName>.<tableName2> AS T3 ON
T3.`ID` =
>> T2.`WebsiteID`;
>>
>> In this query T3.Name from Table2 showing  blank.
>>
>>
>>
>>
>>
>> On Tue, Jan 17, 2017 at 5:06 PM, Sanjiv Kumar <sanjivktr@gmail.com>
>> wrote:
>>
>>> Hello
>>>         I want to know.. Can i get all column name and column count in
>>> single select statement??
>>>
>>> Example:-
>>>                   I have table having total 10 rows and Id, Name, Salary
>>> Column.
>>>
>>> Now, Can i write single query to get all th column name (Id, Name,
>>> Salary) and total count of rows(i.e:- 10) ?
>>>
>>> ex:-   select T1.Id, T1.Name, T1.Salary, Count(*) from
>>> <pluginName>.<schemaName>.<tableName>
>>>
>>> Can anyone tell the solution.??
>>>
>>> --
>>> Thanks & Regards.
>>> Sanjiv Kumar.
>>>
>>
>>
>>
>> --
>> Thanks & Regards.
>> Sanjiv Kumar.
>>
>
>
>
> --
> Thanks & Regards.
> Sanjiv Kumar.
>



-- 
Thanks & Regards.
Sanjiv Kumar.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message