Jump to content

Ancient_Doom

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Ancient_Doom

  1. You need to list each table that you want information from, regardless of whether or not it is a union. It may be possible to write multiple queries or a stored procedure that would get all table names and find the ones you're looking for but I don't have experience doing something like that with stored procedures. It wouldn't be difficult to do that by using another script language to get all of the tables, build the query, and then run it.
    you mean build a table of tables?
  2. Hello. :)I am new to SQL. Ive browsed t hrough some things and have found SQL is not that difficult to pick up. I have a little experience in python and VB. atm, I am working on a code for my clan-leader, and trying to build a query. I am trying to merge two SQL statements, which I know do work.

    select _clan_hoa_user.username as Forumname, _clan_hoa_userfield.field11 as SummonerName, _clan_hoa_user.email as email, _clan_hoa_user.skype as skype,FROM_UNIXTIME(_clan_hoa_user.lastpost,'%Y %D %M') as LastPost  from _clan_hoa_user, _clan_hoa_userfield, _clan_hoa_usergroup	where _clan_hoa_user.userid = _clan_hoa_userfield.userid	and _clan_hoa_user.usergroupid = _clan_hoa_usergroup.usergroupid	AND _clan_hoa_userfield.field11 != ''	AND _clan_hoa_userfield.field20 != 'Yes'	AND _clan_hoa_usergroup.title = 'Member'	AND _clan_hoa_user.username NOT IN ('Bigifinda','Code47')	case WHEN _clan_hoa_user.lastpost = "0" THEN "No Posts"	Else FROM_UNIXTIME(_clan_hoa_user.lastpost) < DATE_SUB(NOW(), INTERVAL 7 DAY)	ORDER BY LastPost ASC

    and

    SELECT username, LastPost,CASE LastPostWHEN "0"THEN "No Posts"ELSE "Illegal Argument"END AS "Status"FROM _clan_hoa_user

    together. They work seperately, but I am trying to merge them, and it produced this:

    select _clan_hoa_user.username as Forumname, _clan_hoa_userfield.field11 as SummonerName, _clan_hoa_user.email as email, _clan_hoa_user.skype as skype,FROM_UNIXTIME(_clan_hoa_user.lastvisit,'%Y %D %M') as LastVisit  from _clan_hoa_user, _clan_hoa_userfield, _clan_hoa_usergroup	where _clan_hoa_user.userid = _clan_hoa_userfield.userid	and _clan_hoa_user.usergroupid = _clan_hoa_usergroup.usergroupid	AND _clan_hoa_userfield.field11 != ''	AND _clan_hoa_userfield.field20 != 'Yes'	AND _clan_hoa_usergroup.title = 'Member'	AND _clan_hoa_user.username NOT IN ('Bigifinda','Code47')	AND lastvisit(select *when "0" then "No Posts"When FROM_UNIXTIME(_clan_hoa_user.lastpost) < DATE_SUB(NOW(), INTERVAL 7 DAY)from _clan_hoa_user)	ORDER BY LastPost ASC

    but I get an error from SQL Fiddle:Schema Creation Failed: 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 * when "0" then "No Posts" When FROM_UNIXTIME(_clan_hoa_user.lastpost)' at line 9: I don't want ya to just feed me the answer to this little problem, but something pointed out so i can learn would be nice. I have looked up information on google and w3schools, but have come up dry so far. edit: and im just just here to get help, ill look around the forum a bit and see what i can learn ;)

×
×
  • Create New...