我该添加什么查询以获得最低的唯一出价?
SELECT auction.title, auction.auction_id, bid.name, bid.price
FROM auction INNER JOIN
bid
ON auction.auction_id = bid.auction_id
答案 0 :(得分:2)
我们可以尝试将<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/svInterests"
style="@style/joyship_page.scroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/joyship_background"
android:fadeScrollbars="true"
android:orientation="vertical"
android:paddingBottom="@dimen/marginMainMinusShadow"
android:scrollbarThumbVertical="@color/colorBrand">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/btnTopInterestsBack"
style="@style/joyship_clickableIconPadded"
android:layout_width="@dimen/iconArrowNarrowEnlarged"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ib_arrow_backward" />
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/btnTopInterestsForward"
style="@style/joyship_clickableIconPadded"
android:layout_width="@dimen/iconArrowNarrowEnlarged"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ib_arrow_forward" />
<TextView
android:id="@+id/tvHeaderTopActivities"
style="@style/joyship_text.header"
android:layout_marginTop="@dimen/halfMainMargin"
android:fontFamily="@font/josefin_sans_regular"
android:text="@string/headerInterestSelection"
android:textSize="@dimen/fontSizeXl"
app:layout_constraintTop_toBottomOf="@id/btnTopInterestsBack"
tools:ignore="SpUsage" />
<android.support.v7.widget.LinearLayoutCompat
style="@style/joyship_viewgroup.card"
android:layout_marginTop="@dimen/marginBeneathOnboardingHeaderShadow"
app:layout_constraintBottom_toBottomOf="parent"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/tvHeaderTopActivities">
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbMusic"
style="@style/joyship_control.checkbox"
android:layout_marginTop="@dimen/halfMainMargin"
android:text="@string/interest_music" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbTv"
style="@style/joyship_control.checkbox"
android:text="@string/interest_tv" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbMovies"
style="@style/joyship_control.checkbox"
android:text="@string/interest_movies" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbGames"
style="@style/joyship_control.checkbox"
android:text="@string/interest_games" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbReading"
style="@style/joyship_control.checkbox"
android:text="@string/interest_reading" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbTravel"
style="@style/joyship_control.checkbox"
android:text="@string/interest_travel" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbSports"
style="@style/joyship_control.checkbox"
android:text="@string/interest_sports" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbExercise"
style="@style/joyship_control.checkbox"
android:text="@string/interest_exercise" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbParty"
style="@style/joyship_control.checkbox"
android:text="@string/interest_party" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbFood"
style="@style/joyship_control.checkbox"
android:text="@string/interest_foodAndBeverage" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbFashion"
style="@style/joyship_control.checkbox"
android:text="@string/interest_fashion" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbPolitics"
style="@style/joyship_control.checkbox"
android:text="@string/interest_politics" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbBusiness"
style="@style/joyship_control.checkbox"
android:text="@string/interest_business" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbTechnology"
style="@style/joyship_control.checkbox"
android:text="@string/interest_technology" />
<android.support.v7.widget.AppCompatCheckBox
android:id="@+id/cbScience"
style="@style/joyship_control.checkbox"
android:layout_marginBottom="@dimen/halfMainMargin"
android:text="@string/interest_science" />
</android.support.v7.widget.LinearLayoutCompat>
</android.support.constraint.ConstraintLayout>
与<style name="joyship_control">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_marginStart">@dimen/marginMainPlusShadow</item>
<item name="android:layout_marginEnd">@dimen/marginMainPlusShadow</item>
<item name="android:fontFamily">@font/josefin_sans_regular</item>
<item name="android:gravity">center_vertical</item>
<item name="android:textColor">@color/colorText</item>
<item name="android:textSize">@dimen/fontSizeM</item>
</style>
<style name="joyship_control.checkbox" parent="joyship_control">
<item name="android:layout_height">@dimen/controllerHeight</item>
<item name="android:background">@null</item>
<item name="android:button">@null</item>
<item name="android:drawableEnd">@drawable/cb_joyship</item>
</style>
结合使用:
GROUP BY
以上查询按出价汇总,然后仅保留那些出现一次的出价(LIMIT
)。然后,它按买入价升序排列,并且仅保留一行,该行是最低价。