Wrong COUNT() Result With Joins?
I'm using this query:
SELECT DISTINCT COUNT(Programme.ProgrammeID) AS Count
FROM Programme
INNER JOIN ProgrammeCategoryLink ON Programme.ProgrammeID = ProgrammeCategoryLink.ProgrammeID
INNER JOIN ProgrammeCategory ON ProgrammeCategoryLink.ProgrammeCategoryID = ProgrammeCategory.ProgrammeCategoryID
WHERE Programme.Enabled = Ƈ'
Which I was expecting to return the total number of records (11) that had Enabled = 1, but it returns 21 (there aren't even that many records).
I've messed around with GROUPING etc but I just can't figure it out. (By the way, the joins need to be there even though im not using them in this instance, as sometimes filtering is on ProgrammeCategory.ProgrammeCategoryID too).
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Using ë Character Results In Wrong Result
I have a table with content. This content has a word, financiën. It has a ë as you can see. When try to ghet it through a select statement in my page (php) I'm seeing other characters. At the moment I see: financi?n. I'm using the following code in my php page: header: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> php section: $resultaat = @mysql_query('select branche from gevraagd'); if (!$resultaat) { exit('<p>Fout bij het ophalen van de aangeboden bedrijven, error: ' . mysql_error() . '</p>'); } while ($row = mysql_fetch_array($resultaat)) { $branche = htmlspecialchars($row['branche'] , ENT_NOQUOTES, 'UTF-8'); echo '<span class="verdana_10p_grey-dark">Branche: ' . $branche . '<br />'; .
When COUNT Counts Wrong
When I ask the table for this precise number of rows ... CODE$result2 = @mysql_query("SELECT COUNT(*)AS t FROM 067staff WHERE m = '10' ");
Count Is Wrong For Innodb Table
I'm running a mysql database using innodb. When I use phpmyadmin to browse records of certain tables, the count keeps changing on me for some reason: Showing rows 0 - 29 (12,340 total, Query took 0.0003 sec) The "12,340" count would sometimes go up, and sometimes go down. It never stays the same. Is there a problem with my database? I can' figure this out. It shouldn't be doing this should it?
Count Of Joins
here is my simple two tables joined. CODESELECT l.id AS lid ,l.title AS ltitle ,c.id AS cid ,c.title AS ctitle FROM links AS l LEFT JOIN category AS c ON c.id = l.category_id
Count On Multiple Table Joins
I have 3 tables: COURSE, USER_COURSE, COURSE_TOPICS What I am trying to do is select all the rows of COURSE and have a count of all users on each course and a count of the topics assigned. Id normally write that as an inline select in oracle but it seems Mysql doesnt work in quite the same way! Using an outer join on just COURSE to USER_COURSE i got it to work: select c.*, count(uc.course_id) as no_of_members from course c LEFT OUTER JOIN user_course uc ON c.course_id = uc.course_id group by course_id; So following that example I then added an extra join to COURSE_TOPIC to get the count of topics: select c.*, count(uc.course_id) as no_of_members, count(ct.topic_id) from course c LEFT OUTER JOIN user_course uc ON c.course_id = uc.course_id LEFT OUTER JOIN course_topic ct ON c.course_id = ct.course_id group by course_id but it returns the wrong figures for both counts!
No Result For Zero COUNT
The following query SELECT COUNT(Id) FROM References WHERE refereeId='3' GROUP BY targetId; returns the desired result if there are several rows that contain the specified refereeId, which is great. But if there are no matching rows, nothing is returned, and I was expecting a return value of zero. Am I using COUNT wrong?
Count The Result Of Group_concat?
I learned group_concat from this forum, very useful command, but I am wondering if I can * COUNT the result of group_concat * for example, the following example, I know this is a wrong clause, but I hope I can COUNT and then use the result to do some HAVING works. So is it possible to count the result of group_concat? SELECT class, sex, COUNT(group_concat(name)) as num from school group by class, sex HAVING num > 20
Result Of COUNT In Conditional
How can I conditionally test for the number of rows returned from a query for, say, use in a stored procedure’s conditional expression? For example, I want an INSERT to occur when IF (SELECT COUNT(*) FROM myTable WHERE id=5) = 1 But I’ve been getting errors, and I’m guessing it has to do with the syntax of this first part of the conditional expression - how can I test the value returned by COUNT to conditionally execute some other statement?
Count A GROUP BY Result
I'm trying to count the result of a GROUP BY query without using the php mysql_num_rows() function. Is this even possible?
Retrive Result Of Count(*)
I am using Count(*) in my Select Code: String sqlStr = "Select count(*) from Bulletin where StartDate<=getDate() and getDate()<=EndDate"; ResultSet resultSet = executeSQL(sqlStr); How do I get the the result of this select statement?
Non-Numeric Result From SELECT COUNT(*)
I'm using MySQL 4.1.11 and MyODBC 3.51.11. I've a problem with SELECT COUNT(*) query. I'm using mysql in ASP. I'm executing this query for example: Select Count(*) as TotalMembers From Members; //with recordset("Totalmembers") -- or -- Select Count(*) From Members; // with recordset(0) but both of these queries aren't giving Numeric (Integer) results... I'm cotrolling them with IsNumeric function by ASP. But it gives False result. Also i cannot using mathematical operators such like +-*/ . Because result isn't numeric. And an error occurs. If you know asp, could you try to use math operators with select count(*) result?
Trying To Count The Number Of Rows In A Result Set After Query
The user fills out this form to sign up to the website, the form checks the database to see if the username has already been taken with the code: $conn = mysql_connect("localhost:3306", "root", "********") or die ("Error With Connection"); echo("connected<br><br>"); $db_sel = mysql_select_db("game",$conn) or die ("Error With Database"); $check = "select * from users where 'username' = '$username'"; $db_sel = mysql_query($check,$conn) or die (mysql_error());
Distinct List Of Parents With A Child Count Result
Parent (id, name) Child (id, parent_id, session_name) I'm trying to write a query that will have one output row per Parent. Each row will show: parent.id, parent.name, count of children for that parent AS children_count Some parents have no children. Those rows could return null or 0 for the children_count field. I know multiple methods external to SQL to solve the overall problem such as returning the join and counting where child.ids (for the same parent) is not null. ==>> but is there a way to do it in one SQL query that returns just the info I need?
How Can I Determine The Offset Of A Result In An Ordered Result Set?
How can I determine the offset of a result in an ordered result set? I would like to pass the calculated offset into the limit half of and ordered select statement. E.g. I have a table that records a id and datetime for captioned photographs. I'd like to show the five photos that were taken after the photo with id=23. To do that I need to find the offset of photo with id=23 in select id, datetime, caption from photos order by datetime; Then I could get the result I want by doing.... select id, datetime, caption from photos order by datetime limit $offset, 5; I've spent several hours scouring around and found some people with similar problems, but no solutions yet.
Natural Joins And Joins With USING
I was wondering if there is a way to make MySQL 5.0.15 ( final release ) able to use natural joins and joins, using old code that worked with 5.0.11 and earlier. Since I am new to starting mysql and modifying it, more information the better.
What's Wrong With SELECT *?
This has been bothering me for a while now, so I decided to come here for some answers. I was told very early on not to use SELECT * and to always specify each field that the SELECT statement should target. This makes sense to me since MySQL doesn't need to do the extra work of going to see what fields are available then finding the data... so its faster. But what if I know ill be selecting every field in the table. And what if that table has 10+ fields. It becomes a pain having to type out all those fields just for a ( minor?) boost in query speed. This becomes even more of a problem when I have multiple queries either on their own or in stored procedures that are all pulling out the same data. If this is the case and I need to add/rename/remove a field from the table then I have to hunt down every SELECT that is targeting that table. Basically im looking for good reasons why I should/shouldn't use SELECT *.
Can Anyone Tell Me What's Wrong With This Query Please
PHP $kkdx = @mysql_query("select id, ".$kli." from secteur order by position") or die(mysql_error()); while ($kkdx1=mysql_fetch_array($kkdx)) { print '<h5>'.$kkdx1[1].'</h5>' $kat_details=@mysql_query(" select members.lastname, members.firstname, members.title, // title = member's field members.localization // localization = member's field from members, localization, // localization = seperate table title // title = seperate table where members.Secteur = ".$kkdx1[0]." and members.localization = localization.id order by localization.position, title.position "); while ($abc=mysql_fetch_array($kat_details)) { print $abc['lastname'].' '.$abc['firstname']; } } I am getting much more rows than what I should get, not ordered as I want, etc ... totally messed up
What Is Wrong With This Syntax
I must be staring at this query to hard. This query is called within a block of PHP code. "UPDATE business SET businessName='$business', profile='$profile', catId='$cat', WHERE id='$id'"; I get an error that says the following: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id=ƈ'' at line 5" The query looks good to me. The id is supposed to = 2.
What's Wrong With This Insert?
INSERT INTO zips (zip, lat, long, city, state, county, type) VALUES (?','+40.922326','-072.637078','HOLTSVILLE','NY','SUFFOLK','UNIQUE');
Wrong With My Syntax
if I have the following tables in my database: +-----------------+ | Tables_in_test | +-----------------+ | temp | | tempallclaims | +-----------------+ 2 rows in set (0.00 sec) shouldn't the following statement: "select * into temp from tempallclaims;" be a valid SQL query? I keep getting an error message. i've also tried a non-existent table name: "select * into tempBack from tempallclaims;" but its a no-go as well.
Used Wrong Password
I installed MySQL through XAMPP application to Windows XP SP2. All was well, I opened the ADMIN of MySQL from the XAMPP Control Panel and received a drop down box asking for user name and password. For username I used my own name. I have since found out that I should have used "root".I went through a whole bunch of problems with "access violation messages which are still coming, although now I know how to shut them off, but I cannot access MySQL at all to change the password to what it was supposed to be.In essence, I cannot use it at all, and I don't know how to make the fix. Could someone please advise?
Wrong Definition
Is this a wrong definition of a mysql db? (no defaults defined) : `date1` int(10) default NULL, `date2` int(10) default NULL, `num_jokes` int(8) unsigned NOT NULL, `title` varchar(255) NOT NULL, `path` text NOT NULL, etc... etc...
Sorting Is Wrong
I have some products in the database and trying to sort them ascend. by their prices. But for example, the price $14.00 comes before than $8.00. How can I correct the problem? As I understood, mysql only checks for the first digit. Not the whole.
Wrong Results
I have the following select statement Code $query_Recordset1 = "SELECT * FROM data where('$beds like $options')"; the $beds variable is a text field, and the $options variable is a drop-down menu. Technically the query works, but when i put in 775 and click ZIP in the drop-down box it shows zip codes that dont even start with a 7, much less a 775
Somethings Wrong With The Mysql_num_rows
I was making a start page, where one must register a personal code, as in password, to proceed to the main site. to check if the code has already been used by someone else, i used the mysql_num_rows() function, but somethings making it fail... this is where i define a function wich is causing the whole jam. ive tried echoeing here and there, turns out the line with the error is the one with the $count = mysql_num_rows($result) or die(mysql_error());... PHP: <?php session_start(); require_once('vars.php'); //connectie maken met DB $db = mysql_connect("localhost", "dieetopmaat_be", "dieetDB") or die(mysql_error()); mysql_select_db(dieetopmaat_be, $db) or die(mysql_error()); function check_presence($table, $row, $value){ $sql = "SELECT * FROM $table WHERE $row = '$value'"; $result = mysql_query($sql) or die(mysql_error()); $count = mysql_num_rows($result) or die(mysql_error()); if($count >= 1) { return TRUE; }else { return FALSE; }
What's Wrong With This Stored Procedure?
I have this stored procedure CREATE PROCEDURE `documents`.`insert_documents_by_id`(in_DocumentId integer, in_DocumentLanguage varchar(255)) BEGIN IF in_DocumentId= -1 THEN insert into document(language) values( in_DocumentLanguage ); select LAST_INSERT_ID(); ELSE update document set language=in_DocumentLanguage where id=in_DocumentId; select in_id; END IF; END $$ I keep getting the following error when I execute it "No database selected" What's wrong... the database is already selected and it's called documents
What's Wrong With This Store Function?
first attempt at it: DELIMITER $$ DROP FUNCTION IF EXISTS `db2`.`difference`$$ CREATE FUNCTION `db2`.`difference` (n1 varchar(10), n2 varchar(10)) RETURNS int BEGIN declare a1 int; declare a2 int; declare a3 int; declare a4 int; set a1=substring(n1,2,3); set a2=substring(n2,2,3); set a3=a1-a2; set a4=sqrt(a3*a3); return a4; END$$ DELIMITER ; error message: Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'declare a2 int; declare a3 int; declare a4 int; set a1=substring(n1,2,3); set a2' at line 1 (0 ms taken)
Whats Wrong With This Syntax?
Here is my query: UPDATE 06_acct_pg_status SET status = 3, last_update = NOW() WHERE pg_id = 10; It worked when it was: UPDATE 06_acct_pg_status SET status = 3 WHERE pg_id = 10; Adding "last_update = NOW()" is what is problematic.
Is This A Wrong Definition Of A Mysql Db?
Is this a wrong definition of a mysql db? (no defaults defined) : `date1` int(10) default NULL, `date2` int(10) default NULL, `num_jokes` int(8) unsigned NOT NULL, `title` varchar(255) NOT NULL, `path` text NOT NULL,
Correct Wrong Spelling
Is it possible with mySQL to get results when the spelling is not exactly correct. E.g. a visitor fills out the field with Amstrdam (note that the "e" is missing). Is there a function for mySQL that also shows results similar to Amstrdam: -Amsterdam -Amsteldam
Whats Wrong With This Sql Query...
$query = "SELECT distinct loguser.icnumber,access.acccode,dealerdtl.name,loguser.fullname,access.period,staff.staffname, amount.amount, DATE_FORMAT(access.actdate, '%d-%m-%Y ')As formatteddate1, DATE_FORMAT(access.expdate, '%d-%m-%Y ')As formatteddate2 FROM dealerdtl,amount,staff,dealer,loguser,access where access.icnumber=loguser.icnumber AND dealer.dealercode=dealerdtl.dealercode AND staff.sid=amount.staffcode AND loguser.icnumber = '$custic'"; This query select multiple rows, how to configure it for one row...
What Is Wrong With This Mysql Statement?
What is wrong with this mysql statement? PHP SELECT * FROM authorize AS u_one INNER JOIN authorize AS u_all ON u_all.department IN ( u_one.department , u_one.department2 , u_one.department3 , u_one.department4 , u_one.department5 , u_one.department6 ) WHERE u_one.username = '$_SESSION[user_name]' AND NOT u_all.lockedstatus = 'LOCKED' SELECT * FROM here LEFT JOIN authorize ON here.username=authorize.username WHERE authorize.username IS NOT NULL;
Whats Wrong With My Query?
Whats wrong with this? SELECT * FROM listings WHERE title REGEXP "^$this->letter" ORDER BY title ASC $this->letter is the variable .....
Wrong Date Being Inserted
I'm trying to insert (via a temp table) a date from a mysql dump (db-A into db-B). Both db A & B use the same column types: DATETIME. So, when I try to insert a date (for example: 2007-02-12 10:08:47) it gets inserted with today's date. in my temp table, I have tried both datetime and varchar with no difference. If I var_dump(); the query before inserting, the date is ok.
Something Gotta Be Wrong With This Query.
[sql]SELECT DISTINCT ID, post_title FROM wp_posts, wp_post2cat WHERE category_id = 1 OR 5 AND post_status = 'publish' ORDER BY rand() LIMIT 5[/sql] Uhm. Something has to be wrong with this query as it is even selecting posts with post_status not equal to publish and posts from cats other than 1 or 5.
Mysqlbinlog Wrong Output
I get following output from "mysqlbinlog mylog-bin-file.001": # at 4 #030818 13:38:00 server id 1 Start: binlog v 4, server v created 700101 1:00:00 The file mylog-bin-file.001 contains many queries but they don't appear in the output from mysqlbinlog. What is wrong?
Whats Wrong With This Query. Using Now(). >= And <=
I have a table with these fields "bought" and "expires" and the date for these are "2006-06-10 10:52:35" and "2006-06-12 10:52:39". but when i run this query $getvoucher = "SELECT bought, expires, NOW() FROM book_voucher WHERE bought >= 'NOW()' AND expires <= 'NOW()'"; It doesn't find a record. $getvoucher1 = "SELECT * FROM book_voucher WHERE expires <= 'NOW()'"; $getvoucher = "SELECT * FROM book_voucher WHERE bought >= 'NOW()'"; Its finding a row for the first statement but not the second.
What Is Wrong Here With FROM_UNIXTIME + UNIX_TIMESTAMP
I am using gentoo-AMD64 and the MYSQL server version provided by gentoo is currently 4.0.24 When I am inserting a DATETIME which is in that magic gap during the change from summer time to normal time, MySQL adds a magic hour. My bug, or a MySQL bug? This is what I am doing: ###################################### mysql> create table a (f1 DATETIME); Query OK, 0 rows affected (0.07 sec) mysql> insert into a VALUES (FROM_UNIXTIME(1130631910)); Query OK, 1 row affected (0.00 sec) mysql> select * from a; +---------------------+ | f1 | +---------------------+ | 2005-10-30 02:25:10 | +---------------------+ 1 row in set (0.00 sec) mysql> select UNIX_TIMESTAMP(f1) from a; +--------------------+ | UNIX_TIMESTAMP(f1) | +--------------------+ | 1130635510 | +--------------------+ 1 row in set (0.00 sec) ###################################### I inserted 1130631910 and later retrieve 1130635510?
Mysqlbinlog Wrong Output
I get following output from "mysqlbinlog mylog-bin-file.001": # at 4 #030818 13:38:00 server id 1 Start: binlog v 4, server v created 700101 1:00:00 The file mylog-bin-file.001 contains many queries but they don't appear in the output from mysqlbinlog. What is wrong?
Load Data - Is This A Bug Or What Did I Wrong?
I'm using MySQL 5.0.27 on Windows. I'm not sure whether this is a bug or if I do something wrong. Hence, I'm posting here. I think it's a bug - but one never knows. I made up some test scenario. It consist of this datafile c:lb.csv --- 1,0f10 2,0f20 3,0f30 4,0f40 5,0f50 --- and this script --- create database if not exists load_bug; use load_bug; create table if not exists lb ( i int not null primary key, s varchar(20) unique not null ); load data local infile "c:lb.csv" into table lb fields terminated by ","; select i from lb where s="0f10"; --- The set remains empty. select * from lb; gives: +---+-------+ | i | s | +---+-------+ | | 0f10 | | 0f20 | | 0f30 | | 0f40 | | 0f50 +---+-------+ Furthermore, if I reverse the sequence of i and s in the table everything works as expected. If I add another data element (j int) it works too.
Small Favor Gone Wrong
I have a VPS account and I am trying to move my sister's professional organizations site onto my server more or less as a favor (getting paid a little - but not really worth my time). It is being hosted by a professional hosting company that supplied me with ftp access to download the site for the move. I am running into a problem because I don't know how to set-up/use mySQL through UNIX. Previously I have used the Plesk interface provided with my VPS account. Plesk (or at least my hosting services configuration of it) won't allow me to create the user I need in order to import the database because the user ID is contained within the user PW. (this is the database coming from the vendor). The original host has been unhelpful at best so I thought before I go to them and ask for assistance (that I am pretty sure I won't get anyway) that I would post here to find out if there is any easy way through this roadblock or if any the unix commands are simple enough, how I would proceed that way.
INSERT Inserts Wrong Value
As the title says, an incorrect value is being stored in my table when doing an SQL query. INSERT INTO picks (id,player_id,position) VALUES(3,20050919104352853297,1) None of those is the primary key, yet the middle number gets messed up when stored. The current field type is varchar(35), latin1_swedish_ci. The value that's being inserted is: 20050919104352854016, so just the last 4 numbers are changing.
#1136 - Column Count Doesn't Match Value Count At Row 1
I'm getting the above error with the following SQL Statement. I cannot seem to find the error in the code. The select statement does pull multiple rows. I'm using my SQL version: 4.1.19 Any clue on why this isn't working? INSERT INTO `Grants` ( `Project_Code` , `Grant_Code` , `Fiscal_Year` , `Capital` ) VALUES ( ( SELECT Project_Code, Grant_Code, FY, SUM( Capital ) FROM Grants_Temp WHERE Project_Code = 'OSUT' AND FY = '2006' AND Claim_Month = '072006' GROUP BY Grant_Code ORDER BY Grant_Code ) )
What Is Wrong With This Multi-table Query?
Here is my query: SELECT articles.article_id, articles.feed_id, articles.title, articles.abstract, articles.link, articles.date FROM articles,feeds,site,sub WHERE (feeds.sub_id=12 AND articles.feed_id=feeds.feed_id) LIMIT 30 This gives me 30 of the exact same article when there are tons of articles. I want articles from all feeds that have the sub_id of 12.
Possibly Wrong Group By Statement?
adspaces textlinks (linked to adspaces via adspace_id) shoppingkart (linked to adspaces via item) Now what I want to do is calculate my database's integrity. That is I want to retrieve the number of textlinks for each adspace and the number of shoppingkart entries for each adspace. SELECT a.adspots, count(t.id) as current_sold, count(s.id) as in_cart,a.current_available, a.idv11, a.title FROM `ll_adspace` as a INNER JOIN `ll_shoppingcart` as s ON (s.item = a.id) INNER JOIN`ll_textlink` AS t ON (t.adspace = a.id) GROUP BY a.id However, I get completely wrong results...possibly a wrong join or group by statement? The results for current_sold and in_cart are way too high.
Text Sometimes Garbled. Using Wrong Character Set?
I’ve been using mysql databases for some time. However, I haven’t really bothered with details such as character sets (which I hardly know anything about anyway...). Now I’d like to make sure things are done properly... This is the story so far; I’ve got a website where most text is pulled from a mysql database. Things look fine when specifying <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> in my webpages. Also, adding data to the database using a form on one of my webpages works fine, as the text displays correctly on the pages after being pulled from that same database. However, not everything is perfect… If I add the characters "åäö" to the database via phpmyadmin, then it is displayed as "???" on the webpage. If I add the characters åäö to the database via my own form on one of my webpages, then it looks fine on the website, but it is displayed as "åäÃ" when viewing it in phpmyadmin. Clearly I need to change something, but what? The only info I find in phpmyadmin regarding character sets is that COLLATION is set to utf8_unicode_ci for my table and that all the text fields in my table has COLLATION set to latin1_swedish_ci. Should both table and fields be set to the same? Are there some other changes to make? Do I need to do any nasty conversions?
What Is Wrong With My Subquery Syntax --PLEEZ
Am trying to produce data points to graph results. I need to chart the cum total of pb.net column. Is there a glaring syntax error here? SELECT pb.sesDateTime, pb.net ( SELECT SUM(pb2.net) FROM privateBooks pb2 WHERE pb2.sesDateTime <= pb.sesDateTime ) AS cumTotal FROM privateBooks pb ORDER BY pb.sesDateTime
MySql From MS SQL - What's Wrong With This Stored Procedure?
I just switched from MS SQL 2000/2005 to MySql. What's wrong with this stored procedure: DELIMITER $$ DROP PROCEDURE IF EXISTS `listing`.`SaveUser` $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `SaveUser`(Id INT, Username VARCHAR(50), EmailAddress VARCHAR(255), Salutation VARCHAR(10), FirstName VARCHAR(50), LastName VARCHAR(50), Password VARCHAR(50), Status INT) BEGIN DECLARE EmailAddressExists BIT; DECLARE UsernameExists BIT; DECLARE ActionDate DATETIME; SET EmailAddressExists = 0; SET UsernameExists = 0; SET EmailAddressExists = !ISNULL((SELECT 1 FROM user WHERE user.EmailAddress = EmailAddress AND NOT user.Id = Id)); SET UsernameExists = !ISNULL((SELECT 1 FROM user WHERE user.Username = Username AND NOT user.Id = Id)); IF EmailAddressExists = FALSE AND UsernameExists = FALSE THEN SET ActionDate = NOW(); IF ID 0 THEN UPDATE user SET user.Username = Username, user.EmailAddress = EmailAddress, user.Password = Password, user.Salutation = Salutation, user.FirstName = FirstName, user.LastName = LastName, user.Status = Status, user.Modified = ActionDate WHERE user.Id = Id; ELSE INSERT INTO user (Username, EmailAddress, Password, Salutation, FirstName, LastName, Created) VALUES (Username, EmailAddress, Password, Salutation, FirstName, LastName, ActionDate); SET Id = @@IDENTITY; END IF; END IF; SELECT Id, ActionDate, EmailAddressExists, UsernameExists; END $$ DELIMITER ; Basically, I want the procedure to return Id, ActionDate, EmailAddressExists, UsernameExists as a result set. EmailAdressExists needs to be set true or false. In MS SQL, I could do SELECT @EmailAddressExists = 1 FROM User where username = 'asdsa'; It looks like that doesn't work in MySql??? The MySql syntax doesn't look very standard. Who the hell came up with LIMIT instead of TOP?
|