Nested Select On Same Table
I'm stuck with an SQL query.
i want to fetch 16 username and avatar from my table where 8 entries should follows one condition and remaining 8 follow another one.
more descriptively,
8 avatar- selected images by user.
8 avatar- default one.
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
SHOW TABLE STATUS & The Nested SELECT Statement
The "SHOW TABLE STATUS" command seems to return a result set, just like "SELECT * FROM SomeTable". Therefore, since the following is valid: SELECT * FROM (SELECT * FROM SomeTable) I inferred that this functionality would extend to the SHOW statement: SELECT * FROM (SHOW TABLE STATUS FROM SomeDataBase) But such a command gives an invalid syntax error. I want to query the data_length from a few tables, place those values into temp variables and then run a second SQL command using those values. Is what I'm trying to do possible?
View Replies !
View Related
Nested Select Using Like
I am trying to use the results of a nested select statement in the 'parent' statement using 'LIKE' as per: SELECT * FROM t1 WHERE c1 LIKE (SELECT c7 FROM t2 WHERE ID = 987); Does anyone know if this is possible? I am getting empty sets when I experiment with the placement of the % signs. For example: SELECT * FROM t1 WHERE c1 LIKE "%(SELECT c7 FROM t2 WHERE ID = 987)%"; Empty set (0.01 sec) Also I have tried to assign the result of the nested select to a variable like: SELECT @v := c7 FROM t2 WHERE ID = 987; But again then have no idea how to put this variable "@v" into a statement using LIKE. Have tried: SELECT * FROM t1 WHERE c1 LIKE '%@v%'; Empty set (0.00 sec)
View Replies !
View Related
Nested Select OR What To Use?
My table: CatID, CatTitle, ParentID Some example data: 1, Movies,0 2, Mymovies,1 3, Jaws, 2 4, Alien, 2 5, Predator,2 6, Final fantasy, 1 7, X-files,1 What i want in my output: Movies (1), Mymovies (2), Jaws (3) Movies (1), Mymovies (2), Alien (4) Movies (1), Mymovies (2), Predator (5) I want to use the output data to make a click-able tree level. example: Movies Mymovies Jaws link?catid=1 link?catid=2 link?catid=3
View Replies !
View Related
My Nested SELECT
SELECT COUNT(1) as numapp FROM post_jobs (SELECT COUNT(pj.1) as numnot FROM post_jobs as pj WHERE member_id='m2e4m387' AND pj.approval = 0) WHERE member_id = 'm2e4m387' AND approval != 0 I've looked stuff up online and have re-arranged this in several different ways. Can count not be used within a nested SELECT?
View Replies !
View Related
Nested SELECT :: Select All Years Except Last
I'm new to MySQL and want to do a nested SELECT statement. i want to get all years stored in the database except the last year: (content is the table and null values exists) SELECT DISTINCT YEAR(content.date) FROM content WHERE(((YEAR(content.date)) IS NOT null)) AND YEAR(content.date) < (SELECT YEAR(MAX (content.date)) FROM content)) ORDER BY YEAR(content.date) DESC What is wrong
View Replies !
View Related
Nested Select Statement
I am working on a feature for my website (MyRoladex.com) where i have a script run through the database once per hour, look to see who has events scheduled that are within the next hour, then look to see what their email/sms/text message preferences are, then email/text them a notification that it is close to time for their scheduled event. Under the Accounts table, i have 5 notable fields: uid, email, mobile, timezone, messagetype Under the DatebookEvents table, the important field is, eventdate (besides 'uid', obviously), which is is YYYY-MM-DD HH-mm-SS format. I did not want to calculate the time zone difference for each user, and then compare it to each of the event dates, and then to the system time, just to see if a notification should be sent, as this would be an immense waste of cpu and bandwidth. The next best thing that i though of was to STORE the event date PLUS or MINUS the time zone difference, whenever the user creates a new event, and then, whenever the user displays their events, it would ADD or SUBTRACT the time zone to the event date, so that it will display correctly for them, AND when the cron job runs once every hour, it will ONLY have to compare the eventdate field with the system time. This is better because the cron job will run once per hour, and have to work with, perhaps, thousands of records, whereas a user may only display his records once or twice per day, thus saving cpu and bandwidth overhead When i was writing the query for the displaying of event details, where i take the event date for the entry they are viewing and ADD or SUBTRACT their time zone to it so that it displays properly according to their time, i came across this problem: Select eid,(eventdate + hour(select Accounts.timezone from Accounts where Accounts.uid='666')),left(note,40) from DatebookScheduler where uid='666' Returns: #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 'select Accounts.timezone from Accounts where Accounts.uid='666')),left(note,40) ' at line 1
View Replies !
View Related
Nested SELECT Statements
I am trying to form a query from a search form where users can search by various catergories. The version of MySQL I am using is 4.0.18 and doesn't seem to support nested select statements since it returns a syntax error at the point I try to use one. I can't use temporary tables or views as there are no permissions for create at the php page level. I really don't know what else to try as my SQL knowledge is not that vast. The query I have built so far is: SELECT DISTINCT clientid, name FROM (SELECT tbl_clientdetails.* , id, date_made from tbl_clientdetails, contact_made WHERE tbl_clientdetails.clientid = contact_made.clientid) AS t1 WHERE id <> any (SELECT id from contact_made where date_sub(curdate(), interval 90 day)<= date_made) AND name like '%boat%' OR industryType like '%boat%' OR comments like '%boat%' OR productBrand like '%boat%'
View Replies !
View Related
How To Improve On A Nested Select
I'm working on a simple data import tool, and I need to insert email addresses from table two into table one, if they don't already exist in table one. I figured this was a pretty easy nested select statement, but what I'm doing is getting my site taken off line for exceeding the CPU limit. Here's the SQL I'm using to get the new email addresses: SELECT distinct value, id FROM table_two WHERE name = 'email_address' AND value NOT IN (SELECT DISTINCT subscriber_email FROM table_one) There are about 4600 rows in table one, and 145,000 rows in table two. Does this seem like it would be a burdensome query? I'm not a SQL expert my any means, so is there a better way to go about this? It seemed like a simple one to me. Maybe my web host is just stingy with the CPU time.
View Replies !
View Related
Using Update With Nested Select
I've got two tables. wp_gameUsers & wp_achievements. Each have a field called points, and I would like to be able to pull a selected record of points from wp_achievements and add it to a selected tally in wp_gameUsers. Like so; UPDATE wp_gameUsers SET points = points + (select points from wp_achievements where achieve_ID = 8 ) where id = 1 Except whenever i do this it updates the number twice, Eg; 250 points from wp_achievements = 500 points.. The ID is unique I just can't figure out what is going on.
View Replies !
View Related
Figure Out Nested SELECT Statements
I try to figure out how to use a nested "SELECT" statement after the "IN" predicate. For example, when I try this code, it doesn't return anything although it should: SELECT book.IDLivre, aut.Prenom, aut.Nom FROM livre book, livreEcritPar ecr, auteur aut WHERE ecr.IDLivre = book.IDLivre AND aut.IDAuteur = ecr.IDAuteur AND book.IDLivre IN ("SELECT book.IDLivre FROM livre book, livreEcritPar ecr, auteur aut WHERE aut.Prenom like '%$firstName%' AND aut.Nom like '%$name%' AND ecr.IDAuteur = aut.IDAuteur AND book.IDLivre = ecr.IDLivre"); So, my question is the following: How should I change syntax in order to make this bunch of code work? I mean, under Oracle SQL, this syntax would be legal and work perfectly, so I'm confused how to solve my problem.
View Replies !
View Related
Syntax Error With Nested SELECT
Working with MySQL 4.0.27-standard via phpMyAdmin (and Perl) I've been getting error #1064 for certain SQL statments, and have traced the problem down to nested SELECTs. This works fine: SELECT `CITY` FROM `pa_geotags` WHERE `PLACE_ID` = 1303 ; Whereas this (just a trivial example to show the point): SELECT `CITY` FROM `pa_geotags` WHERE `PLACE_ID` = (SELECT 1303) ; gives rise to: #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 'SELECT 1303 ) LIMIT 0, 30' at line 1 I've tried several other (more complex) nested SELECTs, all give exactly the same type of error. phpMyAdmin seems to be non-optionally adding 'LIMIT 0, 30' to the end of my SQL before submitting it, but I don't think that's the problem; I sent the same SQL to the same database via a PERL script and also got a syntax error reported.
View Replies !
View Related
Insert With Nested Select Problem
I want to implement a query similar to this in mysql: insert into table1 (field1) (select t2.field2 from table2 t2 where t2.field3="string" and t2.field4=table1.field4) the reference to table1 from the inner query (table1.field4) does not work. Is there a way to achieve this?
View Replies !
View Related
Nested Select Statement Error
the mysql that is loaded on the host i am on is mySQL 4.0.24 whereas the one i am using is mySQL 5.0.27 on my computer. i am having some weird problems where nested statements like this are not working on the server i am on... select * from table1 where id = (select id from table2 where user = 1); this sql statement works fine on my computer but not on the server. it says there is a syntax error when it is run on the server. but this sql doesn't look wrong to me, or it does? i have a feeling that sub queries is not implemented in mysql 4.0 and earlier....but i really don't wish to change all the sql in my scripts to the old method where i have to select * from table1, table2 where table1.id = table2.user; because it will be quite troublesome...
View Replies !
View Related
Nested Select Statement Taking Hours To Execute
I am running a sub select statment so I can compare a couple of tables. If I run the statement from two test tables of 1000 records in each, it will take nine seconds to get the results that I need. However, if I take the same statement and point it to the two tables which contain all the data I need to run against (50560 and 161680 records respectively), it takes hours to run...how long I'm not sure. I fired the statement off yesterday afternoon @ 3pm and it is currently 11:30am the following day...the select statement is still executing. Does anyone have performance on something like this?
View Replies !
View Related
Testing For An Empty Set Returned By A Nested Select Statement
For those of you following the "While Loop Within Select" thread... I've been restructuring my database to incorporate the changes. Now I've got a table of skipped stops rather than a table of stops (I need it that way for various reasons) and I need to return the schedule to the user as long as the user's stop isn't in the list of skipped stops. SO say something like: SELECT yada yada yada FROM schedule AS 's1' WHERE ( SELECT skippedstop_id FROM skippedstops WHERE schedule_id=s1.schedule_id AND location_id=$origin ) == "EMPTY SET" Only I have no idea how to actually test for the empty set from the nested select...
View Replies !
View Related
Nested Sets And Filtering Conversion To Nested Arrays, How?
I am currently working on a project where we want to reuse a tree structure stored in the database. The tree are basically groups/categories of all the content available within the project. Now we want to reuse this data in forum and only show the featured items/nodes. An idea of the tree structure is: + root + Music (f) + Genre - Electronic (f) - Classical (f) Now the problem is that we don't wan to show the whole tree structure within this new forum. But only the ones for example, which are flagged to be featured. For this, we have a field in the groups table. Only I happen to have some problems with reusing this tree hierarchy: The main problem I have is that when I get the whole tree structure using the query SELECT * groups ORDER BY left_id then I have the whole tree. Only when I add "WHERE featured=1" then the left and right node values are becoming invalid because I filtered out possible child or parent nodes. I am curious if anyone could help me how to get the structure in such way I can easily reuse it. I would love to have the featured nodes in a nested array. Something like: root children: music children: electronic, classical etc.
View Replies !
View Related
Nested Query On A Temporary Table
Yeterday I started playing with temporary tables but ran into a problem. Let me describe the situation: As a programmer of a family tree program I want to know if there are any isolated families in a family tree. The program has a table called families and in this table looks as follows:
View Replies !
View Related
Trying To Join Nested Table With Another Table
I am very much a newbie at sql and I was wondering if anyone here could give me some help with my sql. What I am trying to do is display a list of categories in a hierarchal way along with the number of products that fall into each category. I have a nested table that hierarchically stores categories. ....
View Replies !
View Related
Order By Count Of Occurrences In 2nd Table Without Nested Query (MySQL 4.0.27 Workaround)
My ISP is using an old version of MySQL, 4.0.27-max-log. I am using a query that runs fine on my test-server (MySQL 5.0.70-log). The main point of this query is to return an ordered list of volunteers for job assignment. One of the metrics is the number appearances in an activity table. I am using a nested query to COUNT the number of appearances during a specific time window to obtain this metric, but this approach does not appear to work in 4.0.27. Is there a simpler or alternative query that will make 4.0.27 happy? SELECT job10.person_id, people.history, job10.history, ( SELECT COUNT( * ) FROM activity WHERE activity.person_id = people.person_id AND (activity.day = '2009-2-1' OR activity.day = DATE_ADD( '2009-2-1', INTERVAL 3 DAY)) ) AS appearances, CONCAT( first_name, ' ', last_name ) AS name FROM duty_sing_am INNER JOIN duty_people USING ( person_id ) WHERE people.active AND job10.willingness > 0 ORDER BY appearances, job10.history, people.history, job10.person_id
View Replies !
View Related
Nested Set: Problem: Get Branch With Leafs And 1:n Data Conected Via Additional Table
I am quite at the end of my wits, I have a nested set table which leaves are conected with 1:n to a other table. Is it possible to write a query for a nested set to get a branch with its leaves. and at least one of the Entrys for the leafs from the other table? The SQL for the Subtree is: SELECT group3. * , COUNT( group2.id ) -1 AS LEVEL FROM contenttree AS group1, contenttree AS group2, contenttree AS group3 WHERE group3.lft BETWEEN group2.lft AND group2.rgt AND group3.lft BETWEEN group1.lft AND group1.rgt AND group2.lft BETWEEN group1.lft AND group1.rgt AND group1.id =112 GROUP BY group3.lft ORDER BY group3.lft
View Replies !
View Related
Insert Multiple Rows With One Insert Stmt And Nested Select
I'm trying to insert several rows into a table using only one insert statement: insert into component_feature values (select 3,1,sf.software_feature_id,1 from software_feature sf where sf.software_id = 1) When I run the select statement alone, I get the result I want: +---+---+---------------------+---+ | 3 | 1 | software_feature_id | 1 | +---+---+---------------------+---+ | 3 | 1 | 0 | 1 | | 3 | 1 | 1 | 1 | | 3 | 1 | 2 | 1 | +---+---+---------------------+---+ But when I run the complete statement I get: ERROR 1064 (42000): 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 'select 3,1,sf.software_feature_id,1 from software_feature sf where sf.software_i' at line 1 This query is part of a PHP application I'm building. I'd rather not have to write a PHP loop to do multiple inserts.
View Replies !
View Related
Nested Select :: Checkboxes Checked / Not Checked
I'm trying to display a bunch of checkboxes in php and have them checked/not checked based on the results of the following query but I'm getting syntax errors. This would work in mssql how would I accomplish the same thing in mysql? SELECT tblOrg_Type.ID, tblOrg_Type.Org_Type, (Select 'Checked' from tblContactOrgType where OrgID = 8 AND tblOrg_Type.ID = tblContactOrgType.OrgTypeID ) AS Checked FROM tblOrg_Type; Table Structures: tblOrg_Type ID Org_Type tblContactOrgType ID OrgID OrgTypeID
View Replies !
View Related
SELECT INNER JOIN Performance VS Single Table SELECT
I have designed my database using a somewhat oriented approach. Rows are objects, and different type of objects are in different tables, but since my objects share a common set of fields like ExpireDate, Archived, Draft, CreateDate, CreatorID, etc; I have an 'objects' table with these columns, and I have set up a foreign key in other tables where there is a need for a row-to-row integrity. Now my question is, since I have to SELECT using INNER JOIN with object and the corresponding table, merely to filter out archived rows, I am wondering if I would be better off actually putting the common fields into each respective table and get rid of the 'objects' table altogether. I mean, is it more job for the server to actually JOIN the tables for each SELECT versus having a clean design with object oriented approach ? How bad is my design, and what are the recommendations of experts who obviously were tempted to create an object oriented database design?
View Replies !
View Related
INSERT Into New Table, SELECT From Old Table, UPDATE Old Table With New Key
Code: INSERT INTO retailers (retailername, retailerdesc, retailerwebsite, retailerurl, active) SELECT datasource_retailername, datasource_retailerdesc, datasource_retailerwebsite, datasource_retailertrackurl, 1 FROM datasources_retailers_idx AS i LEFT OUTER JOIN retailers AS r ON r.retailername NOT REGEXP REPLACE(i.datasource_retailername, ' ','.+') UPDATE datasources_retailers_idx SET idretailers=last_insert_id(); Here's what I'm trying to do: * Select from old table * check if there is a matching retailer in the new table * If not, insert retailers details into new table * Update a reference column in the old table with the INSERTID primary key value of that row from the new table
View Replies !
View Related
Trying Abort One Select Accessing One Table Locked By Lock Table.
I'd like to configure one time to abort one transaction that are accessing one table locked by lock table write command ex: Transaction A mysql> start transaction; mysql> lock table mytable write; After I'll start new transaction B (another connection) mysql> start transaction; mysql> select * from mytable; It's will become long time to wait... My transaction B never "die". I tried to configure innodb_lock_wait_timeout=20 in my.ini without success,
View Replies !
View Related
Rights To Create Table, Select, Then Drop Table..
I have a need to get data from the db that requires me to=20 1) do a select and create a new table with the results=20 2) run a query against that new table=20 3) drop the new table=20 I have a script on my server that does this using the root account that has all on *.* for the db. It works fine.=20 I now want to get these results on a web page.=20 I want to create a new db user for my .php web page to use to connect to the db that only has the needed priviledges on that specific db to get the job done.=20 what priviledges do I need to give that user?=20 currently I have the following but the user can't even log into the db from the command line..=20 mysql> show grants for user;=20 +----------------------------------------------------------------------- ---------+=20 | Grants for user@% |=20 +----------------------------------------------------------------------- ---------+=20 | GRANT USAGE ON *.* TO 'user'@'%' IDENTIFIED BY PASSWORD '6fe4c0ab2cf30ae3' |=20 | GRANT SELECT, INSERT, UPDATE, CREATE, DROP ON `db1`.* TO 'user'@'%' |=20 +----------------------------------------------------------------------- ---------+=20 2 rows in set (0.00 sec)=20 when I do a "show grants for user", what should I see to allow what I want?
View Replies !
View Related
Select Count Of Data Appearing In One Table From Another Table
I have three tables: t_Products (id, name) t_Shop (id, location, name) t_Carries (product, shop) If Shop carries a product, there will be a value pair in t_Carries but otherwise no record is listed. Is it therefore possible to return a list in MySQL showing something like this shop.Id, product.Id, count(or something) 1 1 0 1 2 1 1 3 1 1 4 0 Or must I use two query and programmatically generate the list?
View Replies !
View Related
Select Data From 1 Table Based On Criteria From Another Table
is it possible to select all the data in one table based on a criteria from another table? for instance i want to select all the therapist from massage_therapist WHERE massage_schedule.finish > 0. i don't want merged results. i just need to list all therapist based on the where criteria from a different table. these two tables have the therapist_id in common.
View Replies !
View Related
Nested Sql
if nested select statement will work in mysql 3.23.53? i have a simple nested select statement which i believe no error on it. here is my nested sql SELECT picid FROM picture WHERE picid IN (SELECT picid FROM lightbox_image WHERE lbid =1)
View Replies !
View Related
Nested IF Statements
Basically i'm asking why doesn't this sql work? One If works fine but i'm not sure if you can nest them like this.. is there a better way? This is narrowing down a products table by a variable being passed that is either subcategory, category or neither and then it narrows down by a brand if a brand is being passed. SELECT * FROM prodSubCat INNER JOIN (prods INNER JOIN prodCat ON prods.prodCatID = prodCat.prodCatID) ON prodSubCat.prodSubCatID = prods.prodSubCatID WHERE (IF(subCatIDParam = 0,(IF(catIDParam = 0, prods.prodCatID LIKE '%',prods.prodCatID = catIDParam)), prods.prodSubCatID = subCatIDParam)) AND (IF(brandIDParam = 0,prods.prodBrandID LIKE '%',prods.prodBrandID = brandIDParam)
View Replies !
View Related
Nested Query
I have two tables one is called Targets and the other Leads: Targets Fields: RecordID, TeamName, Manager, FebTGT Leads Fields: RecordID, TeamName, DateLeadSubmitted, NewSale (value of NewSale defaults to 1) Basically what I want to do is to show ALL the teams and their specific targets from the Targets table and then also show if they have made any leads between two dates - this info would come from the Leads table if they have made no leads I still want their info from the first table to be displayed.I have tried using a LEFT JOIN and this works fine until I have to apply the WHERE condition for the date parameters.
View Replies !
View Related
Nested SELECTS And SUM()
trying to calculate the amount owed by a customer: SELECT c.compdirectdebit_number, SUM( ( cr.cramount + cr.crvat ) - ( SELECT SUM( cppaid ) AS paid FROM companypaid cp WHERE c.compcompanyid=cp.cpcompanyid) ) AS debit FROM company c, companyreminder cr WHERE c.compcompanyid = cr.crcompanyid GROUP BY c.compcompanyid I want to sum the amount+vat and then - the SUM of the payments which should give us the amount owed. The nested select though is obvioulsy wong, but since this is the second time Ive used them, im struggling with the syntax.
View Replies !
View Related
Nested Transactions
If a transaction is started in a stored procedure 'A' that calls stored procedure 'B' which has its own start transaction... commit statements, can 'A' rollback and undo the changes made by 'B' if it decides not to commit any longer?
View Replies !
View Related
Nested Condition?
I'm just getting trouble making a query that should be like this: SELECT * FROM table where [cond1...] AND [cond2...] AND ([cond3...] OR [cond4]); In fact I need to verify if certain value is in one column or another.
View Replies !
View Related
Nested Loop
I have searched thru the forum but didn't find anything that could help me. I have a database with air dates of shows from different years. My query looks like this $res=mysql_query("select DISTINCT * from performance ORDER BY showDate"); The db has the following fields: showID showDate bandID year date Here is the rest of the code: $num=mysql_numrows($res); while ($row = mysql_fetch_assoc($res)) { if ($prev_show_val != $row['date']) { //update the show date here so no dates repeat $prev_show_val = $row['date']; echo " "; echo '<font face=arial size=4 color=#2F4F4F>' . $row['date']. ''; } } which successfully prints out only the unique airdates from the db. What i want to do is have the year listed once for each set of airdates from that year so it would display 1975 once and then all the dates from 1975. Then 1976 would display once and all the dates from that year, etc.
View Replies !
View Related
Nested Tables
I have a situation where I have lots of users. I have a table that saves various information like the last time they logged in, the date they created their account, etc. Each of these users also has data associated with them that would need a table. For example, if each user had their own ToDo list. So my question is what is the best way to store that in a database? My first thought (coming from my programming background) is that I would add a column called todolist to the first table and that column would have a full nested table inside each cell that would store the list of ToDo items along with their priority and completion status, etc. But I don't see any way to do that in mysql. So my second thought is to create table for each individual user called todolist_username. Unfortunately that would give me potentially thousands of tables in my database. Is that the right way to do it or is there another option I'm unaware of?
View Replies !
View Related
Nested Functions
I know you can't use Nested GROUP BY Functions in MySQL, and I know you can't use SubQueries in MySQL ... so is there any substitute without having to resort to hardcode (i'm PHPing)?
View Replies !
View Related
Nested Loops
I have a data base table with fields for 'Town' and 'Title' among others. I need a bit of code that allows me to automatical output to screen a html link list. The problem is I need to only output the 'Town' field once and then all the 'Titles' that have the same town underneath. In a sort of sub menu way. eg: Code:
View Replies !
View Related
Nested Sql Count
I have two tables survey surveyID, title, memberID responses responseID, surveyID, date, status I need to create a query where I can look at each survey and count the number of responses for each. The trouble is, each response has a status of "C" (complete), "P" (paused) and NULL (un finished) Code:
View Replies !
View Related
Nested SELECTS?
SELECT PPosts.* , (SELECT Count(ID) FROM PComments WHERE PComments.ForPostID = PPosts.ID) AS CommentCounts FROM PPosts Well is this possible in MySQL 4? ? ?? Cos i've developed my site in MySQL5 and it worked fine with this, but when i put on the hosting server which is MySQL4 i get this message: #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 'SELECT Count(ID) FROM PComments WHERE PComments.ForPostID = PPo
View Replies !
View Related
Nested SQL Query?
I'm trying to write a query that picks DISTINCT contest entries (based on distinct email addresses), but also randomizes the selection. I have the following now, but isn't correct because it picks a few duplicates. SELECT * FROM contest_entries submitted_date BETWEEN 'datestart' AND 'dateend' GROUP BY email_address ORDER BY RAND() LIMIT $maxWin * I just need display email_address, first_name, last_name, but I've been selecting all for some reason.
View Replies !
View Related
|