Skip to content

Yes/No Format for query column

I have the following query, simplified for this question: SELECT convert(bit, Substring(Max(convert(CHAR(8), tt.transaction_dt, 112) + convert(CHAR(1), tt.trans_live)), 9, 1)) AS is_live FROM …

SQL customer who never order product p1 and p2 together

I do have two table. I want to find customers who never order product p1 and p2 together(there are million rows in this table) Answer If I understand you correctly, with your very limited information, here is the solution. I broke it up to pieces, for you to understand it better

Using top N in sql

statement 1 statement 2 I have tried the above but both are not working. Does anybody know the reason? Answer If you want to update one row, then you can use limit: That said, I would expect id to be unique, so no LIMIT is necessary.