mysql - How to SELECT value from one table based on same value's behavior in another table? -
Please help me with this ... If I have these tables and columns: I want to write a For example, ID So if, say, How does such a query look and how can it be done in a longer query? Thank you! You can connect together. TABLE1 Column with
ID and
TABLE2 with column
FOO and
bar , both of which have different IDs in which All also appear in the
ID column
TABLE1 .
SELECT query to get all the IDs from
ID to
TABLE1 but for this condition Under:
101 will be selected from
id if the number of rows (
X ) where ID appears under
101
FOO column
TABLE2 , then divides by number of rows (
y ) End of column
101
bar Gt appears, less the result of a certain value.
X / Y
101 query.
Comments
Post a Comment