Queries

Follow

Comments

6 comments

  • Avatar
    Davide Garino

    Is it possible to perform multiple 'order by' queries?

    For example I would like to order a table by a column (e.g. price) and then by another column (e.g. publish date) in order to have the table ordered by the publish date and for each publish date ordered by price.

    Thank you!

  • Avatar
    Awesome Table

    Hi Davide,

    Indeed it is possible, you just need to apply "order by F, H desc". I suggest you to consult this website to have additional informations: https://developers.google.com/chart/interactive/docs/querylanguage#order-by.

    Thank you.

    Thomas

  • Avatar
    Randolph Abelardo (Edited )

    @David, assuming: 

    column A - price

    column B - published date

     

    Please try: 

    select ... order by A asc, B desc 

    * replace sorting (asc or desc) as needed.

    * asc is the default when not indicated (e.g. order by B)

  • Avatar
    Paul Cardelli (Edited )

    I would like to add a query to filter by current weekday. Where a colum row might have multiple weekday name such as Monday, Wednesday, Friday

    If the current Weekday is Friday only the rows with Friday would be shown.

    I know the following is wrong but any help would be appreciated.
    Select * where J contains text(dayofweek(now()),"dddd")

  • Avatar
    Awesome Table

    Hi Paul,

    The solution is:
    select * where dayOfWeek(D) contains dayOfWeek(todate(now())) order by D desc

    Note that days are 1-based, so the function returns 1 for Sunday, 2 for Monday, etc.

    Regards,
    Thomas

  • Avatar
    Randolph Abelardo (Edited )

    Hi Paul

    You can learn more about Query by visiting this comprehensive resource by Google.