614 reputation
214
bio website noneatthemoment.de
location Germany
age 33
visits member for 2 years, 7 months
seen 1 hour ago

1d
comment How to combine two queries?
@user3637050 I have no idea what you're talking about. Your question is absolutely unclear.
2d
comment Taking the difference in timestamps between successive entries
A subquery is not exactly a table. It's something "virtual". So how do you reference something you just created and that is not something "solid"? You make it "solid" by giving it a name. Imagine I would have a subquery like (SELECT 1 AS one). When the subquery has no name, how can you distinguish, if one is a column in your table or in your subquery when you select it? You can't. Therefore an alias is needed.
2d
comment Taking the difference in timestamps between successive entries
Exactly. I always forget AS because it's not mandatory and I'm a lazy typer.
2d
comment Taking the difference in timestamps between successive entries
var_init_query is just an alias for the subquery. Here's the documentation for variables in MySQL: dev.mysql.com/doc/refman/5.1/en/user-variables.html
2d
reviewed No Action Needed Schema/Structure to handle secondary computed data
2d
reviewed No Action Needed General access denied error while using import data in SSMS
2d
answered Taking the difference in timestamps between successive entries
2d
reviewed No Action Needed How can I check for stored procedure consistency across multiples servers
2d
reviewed No Action Needed Running two DELETE statements causes a syntax error
Nov
19
reviewed Reviewed Get a teams Rank based their xp
Nov
19
comment How to use max function in such condition?
You can write AS, but it's not necessary.
Nov
19
comment How to use max function in such condition?
+1 for another solution, but I don't think that there will be a measurable performance difference.
Nov
19
comment How to use max function in such condition?
sq is just an alias for the subquery. In this case it's needed. You're doing it wrong in the sense, that you're getting every row from table guestuser and just one row from olduser. The order by and limit is just applied to second query in the union. I also changed union to union all, as this does not care about duplicates. It has better performance than just union.
Nov
19
answered How to use max function in such condition?
Nov
19
comment CONCAT() between different alphabet echoes out '&' ampersand
Much more details? Table structures, method of viewing the result, and so on...
Nov
19
reviewed No Action Needed TPC-DS query generator does not generate all queries
Nov
19
reviewed Reviewed MySQL - Transactions and causality
Nov
19
reviewed No Action Needed MySql backup for certain database contents
Nov
19
reviewed Reviewed I am Trying to Write an Access Query to Get a person having a First Name and Last Name but not all People having any of those names
Nov
14
comment Simple query is slow on 4M-rows table
A group by implicitly does an order by in MySQL <= 5.6 You can skip this by adding ORDER BY NULL or you rewrite the query as SELECT DISTINCT post_id FROM pageviews WHERE user_id = 981; Can you please have a try if it makes a difference?