Hi i have ITEAM A and ITEAM B table. For example Table 2) ITEAM B How to fetch records combined ITEAM A and ITEAM B with ascending order and duplicate records in sql? please help someone Answer
Tag: mysql
MySQL Query – Pending Friends Approval / Relationship between user & friends
I have two tables: g_relationships (id,request_id,receiver_id,status,approved) g_users (which contains: id,username,…) I have a hard time making a query that adds a temporary column, checks whether userid: 4 exists in request_id or receiver_id column, and take the other userid and fetch username from g_…
SQL Query creation with multiple joins
I am working with MYSQL, and want to create a query. I have 3 tables. QUESTION QUESTION_NUMBER QUESTION_DESCRIPTION 1 anydesc 2 anydesc2 ANSWER ANSWER_NUMBER ANSWER_DESCRIPTION 1 anydescANS 2 anydesc2ANS 3 anydesc3ANS And a bridge TABLE QUESTION_ANSWER Q_NUM A_NUM 1 1 2 2 2 3 Now I want to retrieve all the An…
SQL query to get number of clients with last statement equal connected
I need to make a SQL query table ‘records’ structure: It has to show the following: Could somebody help? sample data: desired output: I tried something with sub queries, but it obviously doesn’t work: How should I use the inner selects? I must write a poem, because most of my post is a code.…
Is there any syntactic sugar to using group by columns 1,2,3,…,n in SQL?
I know it isn’t a “good way of doing things”, but we use the following notations in many of our SQL queries : I was wondering if there is an even more succinct way of writing it, e.g. GROUP BY 1-n (Group by col_1 to col_n) Answer Assume you have table with dozen or more columns Consider belo…
How can I get a value when the master table of the outer join is empty?
I have created a table where I get the sum of each item. However, this query returns : 0 row affected. I know what the problem is. If the key_id and cust_id are not in the t1 table specified as an alias, the value cannot be returned because the t1 table is empty. If there is data for key_id in
SQL queries for calculating shipping charges based on subtotal amount [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question ID Name min_amount charge 1 Standard 50.00 3.00 2 Express 50.00 5.00 3 Standard 100.00 2.00 4…
How can I make the trigger return a value?
I have a ‘roomstate’ table that represents states that I keep updated. This is what happens when the employee assigns room 2 to customer 1 whose booking_id is 2. As the table above is continuously updated, the existing contents may become NULL again. I’d like to have a record of updating thi…
optionally enclosed not working, commas breaking upload
I have this table: Here is my load statement: In spend I’ll have a decimal value with a comma like: 1193.72. The spend field gets uploaded as 1. The impressions field that follows is correct and unaffected. Example record: 1/19/2021 | 1,193.72 | 92780 Output: 1/19/2021 | 1 | 92780 I was under the impres…
SQL subquery in SELECT clause
I’m trying to find admin activity within the last 30 days. The accounts table stores the user data (username, password, etc.) At the end of each day, if a user had logged in, it will create a new entry in the player_history table with their updated data. This is so we can track progress over time. accou…