All Questions
16,095 questions
-4
votes
0
answers
45
views
Why is LEFT JOIN skipping identical VARCHAR barcode values in SQL Workbench? [closed]
I have two tables in SQL Workbench, both
sales
Barcode(primary key for each sale)
other sales-related columns…
products
Barcode
product_name, price, etc.
I'm running a simple LEFT JOIN to append ...
-3
votes
0
answers
82
views
How to create new table from parts of original table and create bridge table to remove many to many options? [closed]
Table_A_ID
Column_B
Science
History
Mathematics
1
5
1
1
2
6
1
1
3
7
1
1
I want to take the names of columns Science, History and Mathematics and create a second table:
Table_B_ID
Col 1
1
Science
2
...
-1
votes
1
answer
56
views
mysql join return all records from left table
table comment report
CREATE TABLE $comment_report_table (
`comment_id` int(11) unsigned DEFAULT NULL,
`user_id` int(11) unsigned DEFAULT NULL,
`reason` varchar(100)...
0
votes
0
answers
36
views
Why isn't MySQL using appropriate indexes when available? When forced to use them, the performance difference is dramatic; is this normal?
I've got the following SELECT statement where all columns are properly indexed with the column they're joining on. I.e. all PKs & FKs have a corresponding, single-column index shown later ending ...
-1
votes
1
answer
59
views
SQL syntax Inner Join [duplicate]
I keep getting a syntax error using phpmysql:
UPDATE
allbooks
SET
allbooks.bookCoverImage = books.bookCoverImage,
allbooks.bookDescr = books.bookDescr,
allbooks.bookEbook = books....
0
votes
1
answer
76
views
How to Fetch Chat Data Using Eloquent with Joins?
I'm trying to fetch chat-related data using Eloquent in Laravel 11 but I'm struggling to structure an optimized query using Eloquent relationships or joins.
I have two MySQL tables:
users -> id, ...
0
votes
1
answer
41
views
How are rows matched and outputs determined in a SQL query using S_ID as the join condition? [duplicate]
I am working on a SQL query involving two tables, Stationery and Distributor. I want to understand how rows are matched using the S_ID column and how the output is generated. Specifically, I’m ...
0
votes
1
answer
84
views
What is the quickest and most efficient way to combine two MYSQL queries into one JSON result [duplicate]
I know how to use basic SQL queries but need to know the best way to combine two queries.
For example, I can output users within a certain distance and it automatically adds a distance field. Ideally ...
-2
votes
1
answer
69
views
Simply join 2 tables without condition and cross join, MySQL
table 1:
value
a
b
table 2:
value
c
d
e
I need to get this result:
value
value
a
c
b
d
NULL
e
So, it's like Simple join, when row from 1st table matches corresponding(by order) row in 2nd table ...
0
votes
1
answer
59
views
How do i reference a column in a join?
I was expecting the join to replace the ID 8n document table with the DocType.TypeName
This query yields 1 row as expected
SELECT * FROM `DocType` WHERE `ID`
=1
ID TypeName
1 PDF
This ...
1
vote
1
answer
34
views
mysql join to record first one which is not matched before
i would like to know is it possible to join 2 tables with a condition like delist the item when it has a match for once.
Let me explain,
take a look at -- > https://dbfiddle.uk/yje6VfFz
Table name :...
-5
votes
1
answer
70
views
Not getting unpaid or partially paid records some can help me? [closed]
$draw = intval($request->draw);
$start = intval($request->start);
$length = intval($request->length);
$order = $request->order;
$search = $request->search;
$search = $search['value'];
$...
0
votes
0
answers
25
views
MySQL Full Outer Join having duplicated rows [duplicate]
We have two tables table1:[1,1,null,0,0] and table2: [1,null,0,2]. And i wand to do Full Outer Join.
In MySQL, since there's no direct support for FULL OUTER JOIN, so we are simulating it using LEFT ...
1
vote
1
answer
62
views
MySQL performance difference between join and subquery
Here are two sql :
the first uses join method to execute
the second one uses dependent subquery to execute
IN the slow log ,we can see the examined rows and query time. When the tow methos have the ...
1
vote
0
answers
116
views
WHERE and LIKE not finding everything with JOIN
I'm trying to create a table which lists all the people with job titles that contain 'Professor' and their projects.
I can get a return with the 'Professor and Chair', plus 'Associate Professor', with ...