Skip to content

How to add DISTINCT? #81

@slwu89

Description

@slwu89

Hi, I read the docs several times and I'm still not sure how to add distinct to my Select at end of a query (i.e. in regular SQL, SELECT DISTINCT FROM ... . Unfortunately I cannot provide the data I am using but for the following query I would like to add the distinct=true kwarg to the final Select node. I thought I could do it based on https://mechanicalrabbit.github.io/FunSQL.jl/stable/reference/#SELECT but I am not really sure what is the difference between SELECT and Select. Can someone give me advice on how to accomplish this?

equip_q = From(:Equip) |> As(:equip_tbl) |>
    Where(equip_oeb_selector[nothing]) |> Where(Get.equip_tbl.Site .== "WP") |>
    Join(From(:EquipUnitOps) |> As(:equip_unitops_tbl), on = Get.equip_tbl.ID .== Get.equip_unitops_tbl.Equip) |>
    Join(From(:UnitOps) |> As(:unitops_tbl) |> Where(Fun.in(Get.unitops_tbl.UnitOp, ["Vial Labeling", "Bottle Labeling"]...)), on = Get.equip_unitops_tbl.UnitOp .== Get.unitops_tbl.UnitOp) |>
    Select(Get.equip_tbl.ID, Get.equip_tbl.Name, Get.equip_tbl.UnitOp, Get.equip_tbl.OpArea, Get.equip_tbl.OEB, Get.equip_tbl.RemainingLife, Get.equip_tbl.RoomLocation, Get.equip_tbl.Risk, Get.equip_tbl.Portable, Get.equip_tbl.Site)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions