Select Multiple Invoice No in single MysQl statement - php

I'm trying to select multiple Invoiceno from my database table with one mysql query but i get an empty records
here what i've tried
$invoiceNo1="'".implode("','", $invoiceNo)."'";
$queryInv="SELECT invoice_no,invoice_date,invoicetype FROM invoice_lineitem where invoice_no in ($invoiceNo1)";
but i get an empty array

Related

mysql number of rows mismatch in phpmyadmin and query

I am facing issue in figure out the number of rows in mysql table 'users'.
Number of rows when browse the table is different then number of rows when fire SQL query to count(*) from table.
Screenshot :
but when i fire following query
SELECT COUNT(*) FROM `users`
It is giving me different number of rows
Screenshot is of different database, in actual database records are 7,40,215 and in count query it is 16,12,145
Please help me out to figure this issue out.

How to insert data in many table in mysql in one query

I have a result management system for a school. I have three table in database.
Table1 name mark
Table2 name gpa
Table3 name absent
Last 2 year i could insert data in one query but some days i cannot insert data properly using same code i used before. When i execute command sometimes no data insert into mark table, sometimes no data insert into gpa or absent table. what can i do ?
here is my code below.
mysql_query("
insert into `mark`(`stid`,`roll`,`name`,`section`,`exam`,`year`,`ban1`,`ban2`,`eng1`,`eng2`,`mat`,`ssci`,`sci`,`tmark`)
values('$stid','$roll','$name','$section','$exam','$year','$ban1','$ban2','$eng1','$eng2','$mat','$ssci','$sci','$tmark')");
mysql_query("
insert into `stgpa`(`stid`,`exam`,`year`,`ban1gp`,`ban2gp`,`eng1gp`,`eng2gp`,`matgp`,`sscigp`,`scigp`,`tgpa`)
values('$stid','$exam','$year','$ban1grade','$ban2grade','$eng1grade','$eng2grade','$matgrade','$sscigrade','$scigrade','$avggpa')");
mysql_query("
insert into `absent`(`stid`,`exam`,`year`,`wday`,`abs`)
values('$stid','$exam','$year','$wday','$abs')");
echo"<code>Input successfully</code>";

Display duplicate string from rows containing multiple values

How to get duplicate rows containing same string (crn) from a table & crn can contain multiple values too? I got result only for single valued crn.
I wrote a MySQL Query:
SELECT * FROM event_participation
WHERE event_id=15 AND crn IN (SELECT crn FROM event_participation GROUP BY crn HAVING COUNT(*) > 1) ORDER BY crn;
This query can return rows what I expect for but only for single valued crn as shown in second figure.
The first figure shows duplicate rows while fetching all rows from a table but my MySQl query cannot return these duplicate rows containing one of a crn 720286 as in second figure.
Please help me to display those two rows in second figure too.
GitHub Issue: https://github.com/ErSKS/KhEC/issues/10

MySQL Query to move/copy certain rows rather than the entire table?

I'm currently using the following to move/copy the entire table from one table to another, which works perfectly.
INSERT INTO archivedpks SELECT * FROM pks
However I want to be able to specify what rows I want to move from the pks table to the archivedpks table.
My table has an id column, I want to only move the rows with an id from 25 to 250
How would I modify the query to only work on those rows?
INSERT INTO archivedpks SELECT * FROM pks WHERE id>=25 and id<=250

search and count values in column of mysql result set

I would like to search and count unique values in a column/fieldname of a MySQL Result Set.
In other words, when some lines of one table are stored in a mysql resultset I want to know which values are stored in a specific column/fieldname of all stored lines.
SELECT COUNT(DISTINCT columnname) AS Total FROM yourtable

Categories